GLES2 experiment

pull/16/head
scrawl 12 years ago
parent 2d894fde57
commit 1e7cf4ae1c

@ -64,13 +64,16 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
{ {
// select best shader mode // select best shader mode
bool openGL = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") != std::string::npos); 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. // glsl is only supported in opengl mode and hlsl only in direct3d mode.
if (Settings::Manager::getString("shader mode", "General") == "" std::string currentMode = Settings::Manager::getString("shader mode", "General");
|| (openGL && Settings::Manager::getString("shader mode", "General") == "hlsl") if (currentMode == ""
|| (!openGL && Settings::Manager::getString("shader mode", "General") == "glsl")) || (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); 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"); std::string l = Settings::Manager::getString("shader mode", "General");
if (l == "glsl") if (l == "glsl")
lang = sh::Language_GLSL; lang = sh::Language_GLSL;
else if (l == "glsles")
lang = sh::Language_GLSLES;
else if (l == "hlsl") else if (l == "hlsl")
lang = sh::Language_HLSL; lang = sh::Language_HLSL;
else else

@ -87,6 +87,8 @@
Now, let's get into writing our shader! As you can guess from above, the filename should be 'example.shader'. 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/'. 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 \code
#include "core.h" #include "core.h"

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

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

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

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

Loading…
Cancel
Save