Advertisement

Textures disapearing from full screen to windowed mode

Started by May 17, 2003 09:41 AM
5 comments, last by PsychoPaul 21 years, 9 months ago
Hi, I've been playing around with NeHe's base code. I wanted to understand the code a bit better and how it works. So i decided to modify it and play around. Now i've run into a little problem that i noticed the NeHe code doesn't do. When i am in full screen mode first and i have a texture displayed it works. But when i switch to windowed mode the texture disapears and i have a white quad. Same happens for when i'm in windowed mode and switching to full screen. I've checked the code to make sure it was the same and it seems to be, but i've been looking at the code for a while so it's very much possible that i forgot something. I am binding the texture before i draw the quad. So i don't think it's that. I know i load the texture correctly because it displays exactly the same as the image in the file. I hope someone can help, Thanks. Paul EDIT: Cleaned it up [edited by - PsychoPaul on May 17, 2003 10:42:32 AM]
Paulhttp://members.lycos.co.uk/p79
when u switch display modes, u''re essentially destroying ur current context and re-establishing a new one. although ur gl-specific rendering code may be correct, any gl-context dependent code may break. this is true for textures. u may have binded the texture, but after making a display change u need to reload the textures... glTexImage2d(bla bla) and glTexParameter*(bla bla). At least, thats wat i think is the issue.
- To learn, we share... Give some to take some -
Advertisement
Yeah i was kind of thinking that but i hadn''t tested that. I was hoping there might be an "easy" way... hehe i''ll double check... or should i say tripple check my code and compare it to the base code again. then i''ll try that...

Thanks
Paulhttp://members.lycos.co.uk/p79
When you switch RC and DC you destroy all your textures. You need to reload them all from your BMPs, TGAs etcetera.

Sorry to tell you but it''s the only way. Therefor: Make sure you delete all textures, etcetera before you switch from fullscreen to windowed and vice versa

Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Ahhh, i forgot to reload the textures. sometimes when i look at code for to long i miss things. Well i figured out how it was being done and i incorperated it into my code.

Thanks guys!
Paul
Paulhttp://members.lycos.co.uk/p79
There is, in fact, an easier way. You first need to create a "dummy" gl context. Then when you create your "normal" GL context, use the windows call : wglShareLists to link it with your dummy context. This allows the gl contexts to share lists and textures, so when you delete your normal context, the texture still resides in the dummy context. This also stops you from having to reload fonts etc.
Advertisement
Just don''t destroy your context, hence don''t destroy your window, when you switch modes. Of course depending on what window styles your using you maybe not be able to do that.



There are two evils in programming. Global variables and goto''s

This topic is closed to new replies.

Advertisement