Qbasicnews.com

Full Version: Screenres just freezes...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to open an OpenGL window, though, when I use Screenres with 2 as parameter (which means, an opengl window), it just crashes...does this crash for you aswell?

Code:
Declare Function InitOpenGL (scrWidth As Integer, scrHeight As Integer)

'$include: "\gl\gl.bi"                
'$include: "\gl\glu.bi"  

ScreenRes 640, 480, 32, 1, 2

InitOpenGL(640, 480)

Do
Loop Until Multikey(1)

Function InitOpenGL (scrWidth As Integer, scrHeight As Integer)
    glViewPort 0, 0, scrWidth, scrHeight
    
    glMatrixMode GL_PROJECTION
    glLoadIdentity
    
    gluPerspective 45, scrWidth / scrHeight, 1.0, 100
    
    glMatrixMode GL_MODELVIEW
    glLoadIdentity
    
    glShadeModel GL_SMOOTH
    
    glClearColor 0.0, 0.0, 0.0, 0.0
    glClearDepth 1.0
    
    glEnable GL_DEPTH_TEST
End Function
You need to have it do something.
Try adding a Flip statement within the loop. That should help.

Edit: See this page for the reason- http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgFlip
Thanks! 8)