12-10-2005, 06:19 AM
Weird... :???:
Can you see this?
Can you see this?
Code:
Option Explicit
'$Static
#INCLUDE "\gl\gl.bi"
#INCLUDE "\gl\glu.bi"
#INCLUDE "\gl\glfw.bi"
#INCLUDE "\gl\glext.bi"
Type DisplayType
W as UINTEGER
H as UINTEGER
R_BITS as UINTEGER
G_BITS as UINTEGER
B_BITS as UINTEGER
A_BITS as UINTEGER
D_BITS as UINTEGER
S_BITS as UINTEGER
MODE as UINTEGER
GlVer as zString ptr
As Single FOVy, Aspect, zNear, zFar
End Type
Declare Sub Init_GL_Window( Display As DisplayType )
Dim Display as DisplayType, Ang As Integer
Init_GL_Window Display
Do
GlClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
GlMatrixMode GL_MODELVIEW
GlLoadIdentity
GlPushMatrix
GlTranslateF 0, 0, -5
GlRotateF Ang, 0, 1, 0
Ang+=1
glBegin GL_TRIANGLES
GlColor3F 1,0,0
glTexCoord2F -1,1
glVertex3F -1, 1, 0
GlColor3F 0,1,0
glTexCoord2F -1,-1
glVertex3F -1, -1, 0
GlColor3F 0,0,1
glTexCoord2F 1,-1
glVertex3F 1, -1, 0
GlEnd
GlPopMatrix
GlfwSwapBuffers
Loop Until glfwGetKey( GLFW_KEY_ESC )
GlfwTerminate()
Sub Init_GL_Window( Display As DisplayType )
Display.W = 640
Display.H = 480
Display.R_BITS= 8
Display.G_BITS= 8
Display.B_BITS= 8
Display.A_BITS= 8
Display.D_BITS= 24
Display.S_BITS= 8
Display.MODE = GLFW_FULLSCREEN
If glfwInit() Then
'Successful!
ELSE
Print "Failed to initialize GLFW!"
Sleep 1000
End
End If
If glfwOpenWindow( _
Display.W , _
Display.H , _
Display.R_BITS, _
Display.G_BITS, _
Display.B_BITS, _
Display.A_BITS, _
Display.D_BITS, _
Display.S_BITS, _
Display.MODE ) _
Then
GlfwSwapInterval 1
Display.GlVer = glGetString(GL_VERSION)
ELSE
GlfwTerminate()
End
End If
glViewport 0, 0, Display.W, Display.H
glMatrixMode GL_PROJECTION
glLoadIdentity
Display.FOVy = 45.0
Display.Aspect = Display.W / Display.H
Display.znear = 1
Display.zfar = 110
gluPerspective Display.FOVy, Display.Aspect, Display.zNear, Display.zFar
glShadeModel GL_SMOOTH
glClearColor 0.0, 0.0, 0.0, 0.0
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glEnable GL_COLOR_MATERIAL
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
glPolygonMode GL_FRONT, GL_FILL
glEnable GL_CULL_FACE
End Sub