Restarting OpenGL Graphics() failure

Archives Forums/BlitzMax Bug Reports/Restarting OpenGL Graphics() failure

ima747(Posted 2009) [#1]
See this thread for more details.

Basicly if you start full screen Graphics() (with OpenGL), then EndGraphics(), then start Graphics() again it seems the OpenGL context gets corrupted or lost or something.

This does NOT happen in blitzmax 1.28

This does happen on mac an PC with ATI and NVIDIA graphics cards when compiled under the newest release.


marksibly(Posted 2009) [#2]
Hi,

Ok, found a bug with the built-in GLDrawText which I'm guessing minib3d uses?

But minib3d or your app will still need to recreate all textures/vbs/ibs etc when graphics are created.


ima747(Posted 2009) [#3]
Great! would the bug with GLDrawText be causing problems that would affect newly loaded textures? Extending the problem example. if I loaded textures cameras etc. with each switch into fullscreen graphics the textures were also corrupted after the text was broken. Again, this didn't happen using 1.28 where I was able to switch to fullscreen, do things, remove all my objects etc. switch out, switch back into 3d, re-create everything and it would work.


marksibly(Posted 2009) [#4]
Hi,

Unfortunately, you will now need to reload all textures/VBOs etc whenever graphics are created/destroyed.

V1.28 had a feature where an internal 'hidden' GL context was shared by all 'real' GL contexts, which had the effect of preserving graphics even when the real contexts were destroyed.

Unfortunately, it didn't work on all cards (grrr Intel...) and had to be removed for the sake of wider compatibility, esp on those craptacular Vista+Intel laptops that were all the rage a while back.

You can actually reenable the old behaviour by executing a GLShareContexts before doing anything else however, as noted above, it wont work on certain setups.


ima747(Posted 2009) [#5]
My second problem related to me not fully releasing everything I created before ending graphics, after re-checking I was missing 1 sprite which was causing some problems.

Any chance you could post the fix for GLDrawText as I would like to implement it asap for my testers.

Thanks for all the help mark!


JoshK(Posted 2010) [#6]
Ah crap.

I was very pleased when my users could change the graphics mode without restarting the engine.


marksibly(Posted 2010) [#7]
Hi,

> I was very pleased when my users could change the graphics mode without restarting the engine.

GLShareContexts should still do the trick if you're not worried about the dreaded Vista/Intel combo?