Page 2 of 2

Re: OpenGL Textures Disappear

Posted: Thu Oct 14, 2010 4:28 pm
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.

Re: OpenGL Textures Disappear

Posted: Thu Oct 14, 2010 4:32 pm
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.

Re: OpenGL Textures Disappear

Posted: Thu Oct 14, 2010 5:36 pm
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.