Thread: OpenGL Textures Disappear after SDL_VIDEORESIZE

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    66

    OpenGL Textures Disappear after SDL_VIDEORESIZE

    If I use SDL_RESIZABLE together with OpenGL, after resizing the window, all my textures would disappear.
    Is that normal? And if so, should I reload it again after resizing?

  2. #2
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    If the OpenGL context is lost, the textures and such will be lost. I don't know much about the SDL, but I suppose it's possible that it's dropping context when resizing for some reason. Which still seems like odd behavior to me, so it could be something else entirely too .
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    I seem to recall soething about having to acquire a new instance after resizing, but I could be wrong. I havent worked too much with OpenGL in years.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You have to call SDL_SetVideoMode() when you receive an SDL_VIDEORESIZE event. This is as true when you're not using OpenGL as when you are.

    Just make sure you pass the new window size to SDL_SetVideoMode(), unless you want different behaviour for some reason.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple textures in OpenGL...
    By yaya in forum Game Programming
    Replies: 1
    Last Post: 02-12-2008, 08:24 AM
  2. OpenGL Textures and TGAs
    By ay_okay in forum Game Programming
    Replies: 3
    Last Post: 06-13-2005, 09:06 PM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL, loading BMP Textures?
    By Zeusbwr in forum Game Programming
    Replies: 12
    Last Post: 12-09-2004, 05:16 PM
  5. OpenGL / Moveing textures?
    By Oluf in forum Game Programming
    Replies: 7
    Last Post: 06-08-2004, 01:26 PM