0.6.2: OpenGLRenderer: glInterleavedArrays

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

0.6.2: OpenGLRenderer: glInterleavedArrays

Postby Jamarr » Mon Sep 14, 2009 23:21

Hey CE I ran into a peculiar issue today using v0.6.2 and glInterleavedArrays. I'm not sure if this is relevant to v0.7.0 but I thought I would share this anyway.

Basically I was getting an access violation inside nvidia's opengl driver when calling glInterleavedArrays from CEGUI's OpenGL renderer. The odd thing is that I know this has worked in the past and it was working on another machine with the same hw, sw, and drivers. The other odd thing is that it worked if I attached the vc debugger to the app before the error occured. WTF?

Anyway, I looked into this and noticed that glInterleavedArrays has been 'unofficially' deprecated for awhile. So I tried using the gl*Pointer functions instead and this has fixed the problem. This is the patch I used:

Code: Select all

--- a/CEGUI/RendererModules/OpenGLGUIRenderer/openglrenderer.cpp
+++ b/CEGUI/RendererModules/OpenGLGUIRenderer/openglrenderer.cpp
@@ -212,7 +212,16 @@
    d_currTexture = 0;
 
    initPerFrameStates();
-   glInterleavedArrays(GL_T2F_C4UB_V3F , 0, myBuff);
+   //glInterleavedArrays(GL_T2F_C4UB_V3F , 0, myBuff);
+
+   // this fixes an access violation exception on some video cards caused by
+   // glInterleavedArrays; i am assuming because that function is deprecated.
+   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+   glEnableClientState(GL_COLOR_ARRAY);
+   glEnableClientState(GL_VERTEX_ARRAY);
+   glTexCoordPointer(2, GL_FLOAT, sizeof(MyQuad), &myBuff[0].tex);
+   glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyQuad), &myBuff[0].color);
+   glVertexPointer(3, GL_FLOAT, sizeof(MyQuad), &myBuff[0].vertex);
 
    // iterate over each quad in the list
    for (QuadList::iterator i = d_quadlist.begin(); i != d_quadlist.end(); ++i)


I think it is also worth noting that OpenGL 3.0 has officially deprecated all of these, among many others. Are you planning on addressing that in the OpenGL renderer in 0.7.x?
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby CrazyEddie » Tue Sep 15, 2009 09:15

Hey!

Odd issue. I would not have thought that the function being deprecated should cause an issue - at least until they finally remove it completely. Obviously there's something going on, the fact you get a different result after attaching the debugger is really odd. Do you get the same with different build configs?

For info, we're currently already using the gl*Pointer functions in the v0-7 code.

To answer the question as regards to GL 3.0, I'm aware of the major shift that comes with that, I've briefly looked at a few bits of information about it, but have not taken any steps to support any 3.0 features at the moment. This is largely because I do not have the appropriate hardware, I've been considering an all new machine for a while, though in the current financial climate I am somewhat reluctant to spend vast sums of money on a new machine :lol: However, this will undoubtedly happen sooner or later - it always does ;)

CE.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby Jamarr » Tue Sep 15, 2009 15:18

Yes, I would not expect deprecated functions to misbehave either. I did get the same result using a debug and release configuration. I can say that I do not know the exact state of opengl since I am 'plugging-in' to third-party software (which has numerous issues of it's own...), though as I said I have 2 machines that are identicle (though obviously not) and it runs on one and not the other.

It's not entierly true that attaching the debugger prevents the issue...in fact the only way I was able to catch the error is by attaching at the very last moment. if I start with debugging, or attach the debugger early on in the startup phase, then the error does not occur. Needless to say I've never seen this before lol. But hey it's fixed so I'm not going to bother with it any longer.

I did find out that one of our support personnel was working on that pc over the weekend, but I'm not entierly sure when it started. I just thought I'd let you know about it, since I wasn't sure if you where still using that function in v0.7 or not and the gl*Pointer functions seem to work well. But you are already using them so :pint:
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby Jamarr » Tue Sep 15, 2009 19:51

Just another note. I had forgotten to replace the glInterleavedArrays call in the renderQuadDirect method, so the same access violation popped up again (though at a later point). I removed this call and moved the above fix into initPerFrameStates to handle both locations with the same code, which again fixed the problem.

The only difference between each system I could find was that they are using different monitors. I've never been aware of monitor hardware/drivers causing opengl issues but it seems possible. Also the gfx drivers I'm using are not the latest, but are only 2mo old.

Oh well, I guess I just have to chalk it up as a hardware/driver compatibility issue...
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby CrazyEddie » Wed Sep 16, 2009 18:35

Thanks for the update! Yeah, I hate these kinds of issues, because they don't seem to have any kind of rational explanation. It sounds kind of driver-ish, but on this particular function it's pretty ridiculous (as I understand it, most implementations of glInterleavedArrays internally setup and just call the gl*Pointer funcs anyway, though perhaps not in this particular case!).

CE.

choco
Just popping in
Just popping in
Posts: 4
Joined: Tue Sep 29, 2009 07:43

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby choco » Tue Sep 29, 2009 07:45

Hi Jamarr,
I ran into exactly the same problem (NVidia card, Visual Studio 2008, crashes in debug mode).
Could you post your replacement for the glInterleavedArrays command? I'm a big dummy in all things OpenGL, so I was not able to quickly figure out a replacement.
Thank you!
Martin

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby CrazyEddie » Tue Sep 29, 2009 09:39

/me looks up. Sees patch in first post :)

CE.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby Jamarr » Tue Sep 29, 2009 16:16

That is interesting. I am using ATI video cards. Anyway, if you want to continue using v0.6.2b instead of upgrading to v0.7 then you will need to download the source-code for CEGUI and re-build the CEGUI::OpenGLRenderer. You need to open up CEGUI/RendererModules/OpenGLGUIRenderer/openglrenderer.cpp and anywhere you find

Code: Select all

glInterleavedArrays(GL_T2F_C4UB_V3F , 0, myBuff);

replace it with

Code: Select all

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(MyQuad), &myBuff[0].tex);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyQuad), &myBuff[0].color);
glVertexPointer(3, GL_FLOAT, sizeof(MyQuad), &myBuff[0].vertex);
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

choco
Just popping in
Just popping in
Posts: 4
Joined: Tue Sep 29, 2009 07:43

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby choco » Wed Sep 30, 2009 06:09

Oops, didn't see that. Sorry. Anyway, that seems to have fixed it! Awesome! For me, too, the crashes happened very irregularly. It seems to have been timing related, as when I changed something totally unrelated to the graphics code, the crashes happened. Good catch!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: 0.6.2: OpenGLRenderer: glInterleavedArrays

Postby CrazyEddie » Wed Sep 30, 2009 09:10

Hmmm. This is somehow feeling more and more like a bug in the renderer; I can't really explain why it's suddenly became an issue now though (after about five years). Quite odd :?

CE.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 9 guests