Page 1 of 1

Texture problem with opengl renderer

Posted: Mon May 26, 2008 13:42
by Lucent
Hope i am in the right section here.

First of all i want to thank the whole team for their efforts of making the cegui library this fine piece of software it is by now.

Now to my reason for this thread:
Recently i played around with multiple textures and texture coordinates in depth in my renderer and at a point, the cegui opengl renderer threw out solid colored quads, where the interface textures and text should have been.

After several days i figured out the problem. The client texture unit was
set to something, the cegui opengl renderer did not expect it to be.

So before calling the cegui rendering function, make sure to call glClientActiveTexture(GL_TEXTURE0) ( and/or glActiveTexture(GL_TEXTURE0) ... in my case it had no influence).

Anyways here is one possible solution:

Code: Select all

... code taken from OpenGLGUIRenderer - openglrenderer.cpp:

/*************************************************************************
   setup states etc
*************************************************************************/
void OpenGLRenderer::initPerFrameStates(void)
{
   //save current attributes
   glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);
   glPushAttrib(GL_ALL_ATTRIB_BITS);

// NEW SECTION (not sure, if you can just set one of both)
   glClientActiveTexture(GL_TEXTURE0);
   glClientActiveTextureARB(GL_TEXTURE0);
   glActiveTexture(GL_TEXTURE0);
   glActiveTextureARB(GL_TEXTURE0);
// END OF NEW SECTION

   glPolygonMode(GL_FRONT, GL_FILL);
.....
}


The glClientActiveTexture must be set to GL_TEXTURE0, where the glActiveTexture has no effect. (well, at least in my case)

New entry points have to be defined for the new parameters glClientActiveTexture, glActiveTexture.
I am not very familiar of creating those entry points, but at a quick glance at the glew library, the parameter GL_TEXTURE0 is defined as follows:
#define GL_TEXTURE0 0x84C0

Hope this helps.

hf,
Lucent

Posted: Tue May 27, 2008 08:24
by CrazyEddie
Hi, and welcome :)

Thanks for raising this issue. I'll take a look and either fix it directly or (more likely) add a mantis ticket so that it can be done a little later on :)

CE.

Posted: Tue May 27, 2008 14:59
by CrazyEddie
Just to confirm this as an issue (obviously!), and add a back-link to the mantis ticket: http://www.cegui.org.uk/mantis/view.php?id=201

Although the fix is easy enough, it is slightly complicated by the fact that it only applies in certain GL versions / extension scenarios. As such the fix hitting SVN will be a little longer in the making ;) (Though will likely be a week at the most).

Thanks again.

CE.

Posted: Wed May 28, 2008 23:20
by Lucent
Big Thx for the welcome ;)
I really appreciate your effort in this. ;)

Yeah the whole opengl version thing is kind of annoying, but at least people who can use the search button find maybe a possible solution to their problem for the time being.

Keep it up. CEGUI is my favorite gui library for years now. Love it.

L.