Hi,
can you spot what is making this code not display the object?
thanks alot,
' compile with -lang deprecated -s gui
option static
option explicit
#include "gl/gl.bi"
#include "gl/glext.bi"
#include "gl/glfw.bi"
declare sub clear_buffer ( byval red as single=0.0f,_
byval grn as single=0.0f,_
byval blu as single=0.0f )
declare sub graphics ( byval title as string,_
byval wwidth as integer,_
byval height as integer,_
byval mode as integer=0 )
declare sub init_demo()
declare sub main_demo()
declare sub render_test()
init_demo()
main_demo()
sub init_demo()
graphics("glfw test",640,480,1)
end sub
sub main_demo()
while ( glfwGetKey( GLFW_KEY_ESC )=0 )
clear_buffer()
render_test()
glfwSwapBuffers()
wend
glfwTerminate()
end sub
sub render_test()
dim as single scale_x=10.0f, scale_y=10.0f, scale_z=10.0f
glMatrixMode( GL_MODELVIEW )
glLoadIdentity()
glTranslatef( 0.0f, 0.0f, -10.0f )
glBegin(GL_QUADS)
glColor3f( 1.0f, 1.0f, 1.0f )
glVertex3f( -scale_x,-scale_y,-scale_z )
glVertex3f( -scale_x, scale_y,-scale_z )
glVertex3f( scale_x, scale_y,-scale_z )
glVertex3f( scale_x,-scale_y,-scale_z )
glEnd()
end sub
sub clear_buffer( byval red as single=0.0f, byval grn as single=0.0f, byval blu as single=0.0f )
glClearColor( red, grn, blu, 1.0f )
glClear ( GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT )
end sub
sub graphics( byval title as string, byval wwidth as integer, byval height as integer, byval mode as integer=1 )
glfwInit()
if mode=1 then
glfwOpenWindow( wwidth, height, 8,8,8,8, 32,8, GLFW_WINDOW )
else
glfwOpenWindow( wwidth, height, 8,8,8,8, 32,8, GLFW_FULLSCREEN )
'glfwSwapInterval( 1 )
end if
glfwSetWindowTitle( title )
glViewport ( 0, 0, wwidth, height) ' Reset The Current Viewport
glMatrixMode ( GL_PROJECTION ) ' Select The Projection Matrix
glLoadIdentity () ' Reset The Projection Matrix
gluPerspective ( 45.0f, csng(wwidth/height), 0.1f, 100.0f ) ' Calculate The Aspect Ratio Of The Window.
glMatrixMode ( GL_MODELVIEW ) ' Select The Modelview Matrix
glLoadIdentity ()
glShadeModel ( GL_SMOOTH ) ' Enables Smooth Shading
glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ) ' Black Background
glClearDepth ( 1.0f ) ' Depth Buffer Setup
glEnable ( GL_DEPTH_TEST ) ' Enables Depth Testing
glDepthFunc ( GL_LEQUAL ) ' The Type Of Depth Test To Do
glHint ( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ) ' Really Nice Perspective Calculations
glEnable ( GL_CULL_FACE ) ' Enable Backface culling
glPolygonMode ( GL_FRONT, GL_FILL )
end sub