Opengl not updating image

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Opengl not updating image

Postby ShadowTiger » Tue Mar 06, 2012 04:17

So I just switched from Direct X to OpenGL so that I can try integrating Berkelium into cegui 7.5 using kulik's code for cegui 8.0.

I got everything working by copying code from the CEGuiOpenGLBaseApplication.h into my renderer code and replacing the direct x code.

Right now when I run my program, I see the first frame that should appear, and the spinning cegui logo. The logo renders fine, but my cegui root window is not updating. The fps counter does seem to work fine as well.

The code looks basically like this:

Code: Select all

while (doWin32Events(idle))
 {
        if (idle)
        {
            glutMainLoop();
        }
}


It is calling my drawFrame() function which is identical to the one from CEGuiOpenGLBaseApplication, so I am not sure what else I need to do. I am sure I am missing something obvious here, but could anyone give me any quick tips on what I might need to change?

my cegui mouse cursor works fine as well, just the main cegui root window is not updating properly.


Code: Select all

---- Version 0.7.5 (Build: Nov 19 2010 Static Microsoft Windows MSVC++ 9.0 32 bit) ----
05/03/2012 20:16:20 (Std)    ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module.  TextureTarget support enabled via FBO extension. ----
05/03/2012 20:16:20 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
05/03/2012 20:16:20 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
05/03/2012 20:16:20 (Std)    ---- Scripting module is: None ----

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

Re: Opengl not updating image

Postby CrazyEddie » Tue Mar 06, 2012 08:32

With the given information, I will guess the issue will be related to calling the glutMainLoop function in the middle of - what appears to be - another event loop of some kind. The glutMainLoop function is a function that runs an event loop for whatever window(s) glut has initialised and never returns - so whatever other processing might otherwise have occurred in that outer loop will never happen.

CE.

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Opengl not updating image

Postby ShadowTiger » Tue Mar 06, 2012 11:11

Oh, that makes sense. I was thinking it might be something like that. I simply replaced glutmainloop with drawframe() and now it works beautifully.

Thank you for the quick response!

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Opengl not updating image

Postby ShadowTiger » Tue Mar 06, 2012 11:24

http://img99.imageshack.us/img99/6374/screenshotmj.jpg

I have a weird graphical corruption happening now. Most of the images look normal, but a few are skewed diagonally and wrapping around. Also some are black and white. I realize this probably won't be immediatley recognizable, but I thought I would ask just in case :)

do you think it might be a driver issue? I am using nVidia, pretty recent drivers.

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

Re: Opengl not updating image

Postby CrazyEddie » Tue Mar 06, 2012 11:57

Hi,

This is probably a state related issue. For performance reasons we can not possibly set all OpenGL states, so we only set the ones absolutely necessary. The CEGUIOpenGLRenderer has an option to enable a few other state settings too, which might cover the offending one (and might not), so try that: CEGUI::OpenGLRenderer::enableExtraStateSettings. If this still does not resolve it, you might need to manually reset some offending state or states prior to calling the renderGUI function.

HTH

CE.

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Opengl not updating image

Postby ShadowTiger » Wed Mar 07, 2012 10:11

Thank you for the advice. It looks like I will have to do a bunch of research/guess & check in order to figure this out, since I know nothing about open gl (or direct x for that matter). The enableExtraStateSettings didn't help.


As a side note, for some reason my 8800 GT is getting really bad framerate, its about 60 fps on idle. Meanwhile a different computer with intel integrated graphics is getting 120+ fps on average.

Normally in direct x the 8800 gt gets 1000 fps and the integrated graphics is around 100-200... very odd.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Opengl not updating image

Postby Kulik » Wed Mar 07, 2012 11:34

You could try getting one of the GL debugging tools - buGLe or GDebugger (hope I got this one right).

ShadowTiger wrote:As a side note, for some reason my 8800 GT is getting really bad framerate, its about 60 fps on idle. Meanwhile a different computer with intel integrated graphics is getting 120+ fps on average.

Normally in direct x the 8800 gt gets 1000 fps and the integrated graphics is around 100-200... very odd.


vertical sync is probably enabled

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Opengl not updating image

Postby ShadowTiger » Fri Mar 09, 2012 06:36

Thank you for pointing that out kulik... I suspected that too but without forcing vsync off in the nvidia control panel I can't figure out how to disable it. I don't think Cegui or Freeglut have vsync, so would I use opengl commands to turn it off?

Also, I figured out whats wrong with the images that are displaying improperly. It turns out any image (all pngs) that doesn't have a transparent background is getting screwed up. While it is pretty simple to simply resave all the images on a transparent canvas, I wanted to ask if you knew what opengl state to set that might fix this. I went through the whole list trying all of the booleans and didn't have any success... :(

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

Re: Opengl not updating image

Postby CrazyEddie » Fri Mar 09, 2012 07:20

When I used to use windows for development, I found that when using glut I would have to turn vsync off in the driver! (yeah, ridiculous, but true). Also be aware that we found (on all platforms) using glut to be much slower overall than "other options", but not to the extent that you're seeing there, so once you address the (probable) vsync issue, it may still be a bit slower (though it may not, since you're not using the glut main loop).

I'm not sure about the image issue - that's a real strange one. Is it that the image must have an alpha channel or that the alpha channel bits need to be set to all 1s?

CE.

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Opengl not updating image

Postby ShadowTiger » Fri Mar 09, 2012 07:48

Its okay speed wise, 500 fps aint too shabby.

I am not sure about the alpha channel. I am using photoshop so its unclear whats going on. Not a big deal though, I don't want to waste more time thinking about it. The stupid berkelium demo doesn't even run properly ... and I really don't want to integrate qtwebkit if I don't have to. *sigh*


Return to “Help”

Who is online

Users browsing this forum: No registered users and 4 guests