GLES2 experiment

This commit is contained in:
scrawl 2013-05-25 04:15:24 +02:00
parent 2d894fde57
commit 1e7cf4ae1c
6 changed files with 15 additions and 7 deletions

View file

@ -64,13 +64,16 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
{
// select best shader mode
bool openGL = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") != std::string::npos);
bool glES = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL ES") != std::string::npos);
// glsl is only supported in opengl mode and hlsl only in direct3d mode.
if (Settings::Manager::getString("shader mode", "General") == ""
|| (openGL && Settings::Manager::getString("shader mode", "General") == "hlsl")
|| (!openGL && Settings::Manager::getString("shader mode", "General") == "glsl"))
std::string currentMode = Settings::Manager::getString("shader mode", "General");
if (currentMode == ""
|| (openGL && currentMode == "hlsl")
|| (!openGL && currentMode == "glsl")
|| (glES && currentMode != "glsles"))
{
Settings::Manager::setString("shader mode", "General", openGL ? "glsl" : "hlsl");
Settings::Manager::setString("shader mode", "General", openGL ? (glES ? "glsles" : "glsl") : "hlsl");
}
mRendering.createScene("PlayerCam", Settings::Manager::getFloat("field of view", "General"), 5);
@ -93,6 +96,8 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
std::string l = Settings::Manager::getString("shader mode", "General");
if (l == "glsl")
lang = sh::Language_GLSL;
else if (l == "glsles")
lang = sh::Language_GLSLES;
else if (l == "hlsl")
lang = sh::Language_HLSL;
else

View file

@ -87,6 +87,8 @@
Now, let's get into writing our shader! As you can guess from above, the filename should be 'example.shader'.
Make sure to also copy the 'core.h' file to the same location. It is included in shiny's source tree under 'Extra/'.
Important: a newline at the end of the file is <b>required</b>. Many editors do this automatically or can be configured to do so. If there is no newline at the end of the file, and the last line is '#endif', you will get the rather cryptic error message " ill formed preprocessor directive: #endif" from boost::wave.
\code
#include "core.h"

View file

@ -10,7 +10,7 @@ namespace sh
{
public:
virtual void execute() = 0;
virtual ~Action();
virtual ~Action() {}
};
class ActionDeleteMaterial : public Action

View file

@ -15,7 +15,7 @@ class Query
public:
Query()
: mDone(false) {}
virtual ~Query();
virtual ~Query() {}
void execute();

View file

@ -58,7 +58,7 @@
#endif
#if SH_GLSL == 1
#if SH_GLSL == 1 || SH_GLSLES == 1
#define shFract(val) fract(val)

View file

@ -206,6 +206,7 @@ void OgreRenderer::configure(const std::string &logPath,
pluginDir = absPluginPath.string();
Files::loadOgrePlugin(pluginDir, "RenderSystem_GL", *mRoot);
Files::loadOgrePlugin(pluginDir, "RenderSystem_GLES2", *mRoot);
Files::loadOgrePlugin(pluginDir, "RenderSystem_GL3Plus", *mRoot);
Files::loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mRoot);
Files::loadOgrePlugin(pluginDir, "Plugin_CgProgramManager", *mRoot);