Rendering messed up after fullscreen minimized

BlitzMax Forums/BlitzMax Programming/Rendering messed up after fullscreen minimized

beanage(Posted 2009) [#1]
Yea, title tells it..

Could not find something really helpful in the forums so far on this.

Here's the problem: I got a fullscreen application. I use some extra OpenGL on top of GLMax2D (Framebuffer Objects and Display Lists). It runs like a charm. I minimize it, maximize it and W T F ... openGL render states messed up, images not being displayed, _huge_ performance impact (1000 UPS to ~ 3; cant really check out because UPS text consists of white blocks).

Again, propably, the solution is so obvious I am too silly to see it.. is this a common problem?

[Edit:] Obviously not^^
[Edit2:] Grey Alien reported a problem with similar cause (switching apps) 9 months ago, but with different effects and .. no real solution.
[Edit3:] Renderstates messed up: blendmode solid (despite the app keeps telling to set it different), texture disabled. That perf drop might have something to do with a changed VSync hertz val?

[FINAL EDIT:] GLShareContexts() does fix it! The reason is, (which I now know thanks to Muttley), that each time you re-maximise a fullscreen window, the OpenGL context gets also re-created.


ImaginaryHuman(Posted 2009) [#2]
Are you using the latest version of BMax?


Muttley(Posted 2009) [#3]
Try adding a GLShareContexts() before creating your graphics device.


beanage(Posted 2009) [#4]
@IH: Yes, 1.34.
@Muttley: That fixed it!! Uhm.. can you explain why?


Muttley(Posted 2009) [#5]
As far as I understand it, when you load textures they are bound to the currently active OpenGL context. When you minimise from full-screen and then maximise again, the context needs to be recreated. At which point the textures no longer exist as they were bound to the old context. So you either reload all your textures or you specify that textures can be shared between contexts.

Someone who understands OpenGL a bit better than me might have a better description.


beanage(Posted 2009) [#6]
Thank you, for the second time in two days - !