View previous topic :: View next topic |
Author |
Message |
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Sat Aug 06, 2005 7:54 am Post subject: SDL_UpdateRect crash |
|
|
does anyone else get an 'Access Violation' when they try to call SDL_UpdateRect? I'm new to windows so I'm not really sure what type of problem this is, I assume it is something to do with modifying memory I'm not supposed to be modifying? I know it is not derelict otherwise I would get an exception error message.
The reason I'm trying to call this function is because I read this GD.net post...
GD.net wrote: |
To resize the window without having it die, you'll need to use
SDL_UpdateRect(). By all logical reasoning, this shouldn't be
necessary, but it's the only way I've been able to get SDL to resize
the window and not kill itself in the process. Here's a quick snipped
of code to show you how it's meant to be used:
SDL_Event event;
//get the event here
switch (event.type){
case SDL_VIDEORESIZE:
SDL_UpdateRect(mySDLSurface,0,0,0,0);
glViewport(0,0,event.resize.w,event.resize.h);
break;
}
|
When I resize my SDL window, I lose my all OpenGL textures.
Appreciate any help, thanks. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Sat Aug 06, 2005 10:17 am Post subject: Re: SDL_UpdateRect crash |
|
|
clayasaurus wrote: | does anyone else get an 'Access Violation' when they try to call SDL_UpdateRect? I'm new to windows so I'm not really sure what type of problem this is, I assume it is something to do with modifying memory I'm not supposed to be modifying? I know it is not derelict otherwise I would get an exception error message.
The reason I'm trying to call this function is because I read this GD.net post...
GD.net wrote: |
To resize the window without having it die, you'll need to use
SDL_UpdateRect(). By all logical reasoning, this shouldn't be
necessary, but it's the only way I've been able to get SDL to resize
the window and not kill itself in the process. Here's a quick snipped
of code to show you how it's meant to be used:
SDL_Event event;
//get the event here
switch (event.type){
case SDL_VIDEORESIZE:
SDL_UpdateRect(mySDLSurface,0,0,0,0);
glViewport(0,0,event.resize.w,event.resize.h);
break;
}
|
When I resize my SDL window, I lose my all OpenGL textures.
Appreciate any help, thanks. |
I'm confused - is the access violation happening when you call SDL_UpdateRect, or is it happening later as a result of calling it?
If the former, make sure the surface pointer you pass in is a valid one.
As for losing the textures, I'm not sure what's going on. I know that on Windows when you recreate a window, you have to also destroy and recreate the OpenGL context, which in turn means you lose all of your current state and other data. But that shouldn't be happening as a result of resizing. SDL must be doing something really weird under the hood.
So, exactly when does the access violation occurr? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|