OpenGL Textures Disappear

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

RandomDever
Chaos Rift Regular
Chaos Rift Regular
Posts: 198
Joined: Thu Mar 26, 2009 8:42 pm
Current Project: My Engine
Programming Language of Choice: C++

Re: OpenGL Textures Disappear

Post by RandomDever »

qpHalcy0n wrote:The reason this happens is because on a resize, minimize, or mode switch, SDL *literally* makes an entirely new window, which is just stupendously silly.
Yes. Yes it is. :|
Well instead of doing your hack my last resort is to use lists and have my 'LoadTexture()' function add a pointer to the texture in the list then have a 'ReloadTextures()' function to iterate through all the pointers reload and rebind each one. I have implemented that but am now getting a link error:

Code: Select all

video.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: struct GLtexture2d * const & __thiscall std::list<struct GLtexture2d *,class std::allocator<struct GLtexture2d *> >::_Const_iterator<1>::operator*(void)const " (??D?$_Const_iterator@$00@?$list@PAUGLtexture2d@@V?$allocator@PAUGLtexture2d@@@std@@@std@@QBEABQAUGLtexture2d@@XZ)
If you can tell me a way to fix this It would be appreciated.
However in regards to the hack I tried not using SDL_SetVideoMode but nothing happened...
The program was running but there wasn't a window. So yeah.
qpHalcy0n
Respected Programmer
Respected Programmer
Posts: 387
Joined: Fri Dec 19, 2008 3:33 pm
Location: Dallas
Contact:

Re: OpenGL Textures Disappear

Post by qpHalcy0n »

I'm not sure I see what you're trying to do or why it should be so unnecessarily complicated.

When the mode switch happens, any pointers to assets you have (had) will be gone and dead. Whatever method you used in your initialization step to add textures to the SDL simply needs to be called again.
RandomDever
Chaos Rift Regular
Chaos Rift Regular
Posts: 198
Joined: Thu Mar 26, 2009 8:42 pm
Current Project: My Engine
Programming Language of Choice: C++

Re: OpenGL Textures Disappear

Post by RandomDever »

qpHalcy0n wrote:I'm not sure I see what you're trying to do or why it should be so unnecessarily complicated.

When the mode switch happens, any pointers to assets you have (had) will be gone and dead. Whatever method you used in your initialization step to add textures to the SDL simply needs to be called again.
Well I don't have a function that contains all the texture loading.
But I will put one in and try it.

Edit: It works. Thanks.
Post Reply