Uses "TBGL"
DIM i AS LONG
%GL_COLOR_BUFFER_BIT = &H00004000
%GL_DEPTH_BUFFER_BIT = &H00000100
DECLARE function glVertex3f LIB "opengl32.dll" ALIAS "glVertex3f" ( x AS single, y AS single, z AS single) as long
DECLARE FUNCTION glColor4f LIB "opengl32.dll" ALIAS "glColor4f" ( red AS SINGLE, green AS SINGLE, blue AS SINGLE, alpha AS SINGLE) AS LONG
DECLARE FUNCTION glBegin LIB "opengl32.dll" ALIAS "glBegin" (BYVAL mode AS DWORD) As Long
DECLARE FUNCTION glEnd LIB "opengl32.dll" ALIAS "glEnd" () AS LONG
DECLARE FUNCTION glRotatef LIB "opengl32.dll" ALIAS "glRotatef" (BYVAL angle AS SINGLE, BYVAL x AS SINGLE, BYVAL y AS SINGLE, BYVAL z AS SINGLE) AS LONG
DECLARE FUNCTION glClear LIB "opengl32.dll" ALIAS "glClear" (BYVAL mask AS DWORD) AS long
DeCLARE FUNCTION glLoadIdentity LIB "opengl32.dll" ALIAS "glLoadIdentity" () AS LONG
DECLARE FUNCTION gluLookAt LIB "glu32.dll" ALIAS "gluLookAt" (BYVAL eyex AS DOUBLE, BYVAL eyey AS DOUBLE, BYVAL eyez AS DOUBLE, BYVAL centerx AS DOUBLE, BYVAL centery AS DOUBLE, BYVAL centerz AS DOUBLE, BYVAL upx AS DOUBLE,BYVAL _
upy AS DOUBLE, BYVAL upz AS DOUBLE) AS LONG
TBGL_CreateWindow ' Creates OpenGL window, it returns handle
TBGL_ShowWindow ' Shows the window
For i = 1 to 360
glClear (%GL_COLOR_BUFFER_BIT OR %GL_DEPTH_BUFFER_BIT)
glLoadIdentity
gluLookAt (0,0,5,0,0,0,0,1,0) ' Setups camera to look from 0,0,5 to 0,0,0
glRotatef (i,1,1,1)
glBegin %GL_TRIANGLES ' Starts polygon definition based on triangles
glColor4f (1,0,0,1) ' Sets RGBA color
glVertex3f (-1,-1,0) ' Adds vertex
glColor4f (0,1,0,1)
glVertex3f (1,-1,0)
glColor4f (0,0,1,1)
glVertex3f (0, 1,0)
glEnd ' Ends polygon definition
TBGL_DrawFrame ' Swaps the buffers - displays rendered image
next
TBGL_DestroyWindow ' Closes OpenGL window
Thanks a lot,
Bookmarks