Hello! I have a question about using Glut.
Moreover, I want to preserve "sort of compatibility" with the C language and use the glu functions.
I want the rectangle to rotate, and it does, but only when I resize the window.
I have the impression that glutMainLoop( ) in freebasic
it works incorrectly.
I'm right? Or just something needs to be changed in the program?
Code: Select all
'' Issue: Rectangle only rotates when window is resized
''Need: constant rotation
#include once "\GL\glut.bi"
'' glutMainLoop( ) doesn't seem to work properly???
Dim shared As Single rtri=0 ''Rotation angle for rectangle
sub display cdecl( ) '' GLUT callbacks are always CDECL
glClear( GL_COLOR_BUFFER_BIT )
glBegin( GL_POLYGON )
glColor3ub 0,0,255 'blue square
glVertex3f( -0.5, -0.5, 0 )
glVertex3f( -0.5, 0.5, 0 )
glVertex3f( 0.5, 0.5, 0 )
glVertex3f( 0.5, -0.5, 0 )
glEnd( )
glRotatef (rtri, 0, 1, 0)
'rtri=rtri+5
glFlush( )
rtri=rtri+5
end sub
'int main ;)
'' this is needed to make GLUT happy, passing 0 and NULL won't work
glutInit( 1, strptr( " " ) )
glutCreateWindow( "simple" )
glutDisplayFunc( @display )
glutMainLoop( )
' end main
end