The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Simple SDL2 + OpenGl Resize Event
NoxMortem


Joined: 04 Apr 2013
Posts: 5
It seems like there aren't many tutorials for SDL 2 out yet as it is going to be released in may but maybe someone could help me.

In SDL 1.3 it seems like an window resize and context resize was simply:
Code:
void CApp::OnEvent(SDL_Event* Event) {
    switch(Event->type){
        case SDL_WINDOWEVENT_RESIZED:resizeWindow([b]Event.resize.w[/b],[b]Event.resize.h[/b]); break;
    }
}
void resizeWindow(int w, int h){
    glViewport(0,0,w,h);
}


But in SDL2 it seems like the event does not have the variable resize anymore. How has this changed and what is the new way of obtaining the new window size to resize events.

Thank you all in advance,
Best Wishes
Kevin
Simple SDL2 + OpenGl Resize Event
Jonny D


Joined: 12 Sep 2009
Posts: 932
Here ya go: http://wiki.libsdl.org/moin.fcg/SDL_WindowEvent

You can also look at the headers for the definitive details of the new data structures until a release is made.


Jonny D



On Wed, Apr 17, 2013 at 6:14 AM, NoxMortem wrote:
Quote:
It seems like there aren't many tutorials for SDL 2 out yet as it is going to be released in may but maybe someone could help me.

In SDL 1.3 it seems like an window resize and context resize was simply:



Code:

void CApp::OnEvent(SDL_Event* Event) {
    switch(Event->type){
        case SDL_WINDOWEVENT_RESIZED:resizeWindow(Event.resize.w,Event.resize.h); break;
    }
}
void resizeWindow(int w, int h){
    glViewport(0,0,w,h);
}





But in SDL2 it seems like the event does not have the variable resize anymore. How has this changed and what is the new way of obtaining the new window size to resize events.

Thank you all in advance,
Best Wishes
Kevin


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

NoxMortem


Joined: 04 Apr 2013
Posts: 5
Thank you! Exactly what i needed!