libRocket issues on android (GLES2 render system)

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
j1230xz
Gnoblar
Posts: 21
Joined: Mon May 13, 2013 3:21 pm

libRocket issues on android (GLES2 render system)

Post by j1230xz » Mon May 13, 2013 3:41 pm

First, let me tell you that I have searched the net and these forums for a possibly solution on my issue with no luck.
Second: I have made an in-depth analysis and have tried many times to solve the issue by myself before asking here.

Let me clarify my problem:

I am trying to use gamekit as a game Engine. For those who do not know what gamekit is, it is an opensource game engine using ogre as rendering engine. For more info visit https://code.google.com/p/gamekit/

Now to the issue: gamekit is using librocket as UI library. The way librocket is by using a custom Ogre::RenderTargetListener to catch rendering events which it then forwards internaly to the library. The result is compiled geometry that is converted to Ogre compatible geometry or RenderOperation. Then the _render method is invoked from the appropriate RenderSystem (in my case it is Ogre::GLES2RenderSystem). All is good so far: librocket will give me the geometry and the textures, the appropriate conversion to Ogre RenderOperation will take place and then the render method will be invoked. However here the application crashes. The problem lies in

Code: Select all

 void GLES2RenderSystem::_render(const RenderOperation& op)
method when it tries to get the active link program

Code: Select all

GLSLESLinkProgram* linkProgram = GLSLESLinkProgramManager::getSingleton().getActiveLinkProgram();
in OgreGLES2RenderSystem.cpp ln 1530 i think.

After some analysis I came to think that there are no active shaders for the rendering to be completed (since gles2 is using the programmable pipeline). This is when i tried to manually load some simple shaders and bind them. This is what I did:

Code: Select all

	vertProg = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram("SimpleTexturingNoLightsVP",
										     DEFAULT_ROCKET_RESOURCE_GROUP,
										     "glsles",
										     Ogre::GPT_VERTEX_PROGRAM);
	   vertProg->setSource(
		 "#version 100\n"
		 "void main(void) {\n"
		 "gl_Position   = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
		 "}\n");
	   vertProg->load();

	   fragProg = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram("SimpleTexturingNoLightsFP",
										     DEFAULT_ROCKET_RESOURCE_GROUP,
										     "glsles",
										     Ogre::GPT_FRAGMENT_PROGRAM);
	   fragProg->setSource(
      "#version 100\n"
      "void main(void) {\n"
        "gl_FragColor[0] = 0.0;\n"
        "gl_FragColor[1] = 0.0;\n"
        "gl_FragColor[2] = 1.0;\n"
      "}\n"
                 );
           fragProg->load();
then before rendering the scene (before calling the _render method from the Render system i bind the shaders

Code: Select all

	render_system->bindGpuProgram(vertProg->_getBindingDelegate());
	render_system->bindGpuProgram(fragProg->_getBindingDelegate());
after this the render is called.

Now the application does not crash since there is the active link program, however nothing is drawn to the screen. For people that know this issue both the code used here will be familiar since part of it is actually found online as a possible solution to issue like this.

Are there any hints on what I should look at?

Another way to ask this question is how can i inherit the Ogre::RenderTargetListener and draw a simple cube in postRenderTargetUpdate method by calling Ogre::GLES2RenderSystem::_render method.

Thank You in advance,
Nikola T.
0 x

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: libRocket issues on android (GLES2 render system)

Post by c6burns » Wed Jun 12, 2013 11:20 am

This reply comes very late, but since I am also attempting to link together a GLSL ES vp and fp at runtime I found this thread.

gl_ModelViewProjectionMatrix and gl_Vertex are not built-in variables in GLSL ES so your program would not be compiling correctly.
0 x

Post Reply