#Include "windows.bi"
#Include "GL/glu.bi"
Sub RenderScene
Static rtri As Single
glClear GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT
glPushMatrix
glLoadIdentity
glTranslatef 0.0, 0.0, -4.0
glRotatef rtri, 0, 1, 0
glBegin GL_TRIANGLES
glColor3f 1.0, 0.0, 0.0 'Red
glVertex3f 0.0, 1.0, 0.0 'Top Of Triangle Front)
glColor3f 0.0, 1.0, 0.0 'Green
glVertex3f -1.0,-1.0, 1.0 'Left Of Triangle Front)
glColor3f 0.0, 0.0, 1.0 'Blue
glVertex3f 1.0,-1.0, 1.0 'Right Of Triangle Front)
glColor3f 1.0, 0.0, 0.0 'Red
glVertex3f 0.0, 1.0, 0.0 'Top Of Triangle Right)
glColor3f 0.0, 0.0, 1.0 'Blue
glVertex3f 1.0,-1.0, 1.0 'Left Of Triangle Right)
glColor3f 0.0, 1.0, 0.0 'Green
glVertex3f 1.0,-1.0,-1.0 'Right Of Triangle Right)
glColor3f 1.0, 0.0, 0.0 'Red
glVertex3f 0.0, 1.0, 0.0 'Top Of Triangle Back)
glColor3f 0.0, 1.0, 0.0 'Green
glVertex3f 1.0,-1.0,-1.0 'Left Of Triangle Back)
glColor3f 0.0, 0.0, 1.0 'Blue
glVertex3f -1.0,-1.0,-1.0 'Right Of Triangle Back)
glColor3f 1.0, 0.0, 0.0 'Red
glVertex3f 0.0, 1.0, 0.0 'Top Of Triangle Left)
glColor3f 0.0, 0.0, 1.0 'Blue
glVertex3f -1.0,-1.0,-1.0 'Left Of Triangle Left)
glColor3f 0.0, 1.0, 0.0 'Green
glVertex3f -1.0,-1.0, 1.0 'Right Of Triangle Left)
glEnd
glPopMatrix
rtri = rtri + 2.0
Flip
End Sub
ScreenRes 640, 480, 32,,2 'OpenGL-Modus
Dim As HWND hwnd
ScreenControl(2 ,Cast(Integer, hwnd)) 'GET_WINDOW_HANDLE
'http://msdn.microsoft.com/de-de/library/bb979284.aspx
SetWindowLong hwnd, GWL_STYLE, WS_POPUP Or WS_VISIBLE 'geränderten Fensterstil setzen
SetWindowLong hwnd, GWL_EXSTYLE, WS_EX_LAYERED 'erweiterter Fensterstil setzen
SetLayeredWindowAttributes(hwnd, 0, 0, LWA_COLORKEY)'Transparenzinformationen zuweisen
glViewport 0, 0, 640, 480 ' Reset The Current Viewport
glMatrixMode GL_PROJECTION ' Select The Projection Matrix
glLoadIdentity ' Reset The Projection Matrix
gluPerspective 45.0, 640.0/480.0, 0.1, 100.0 ' Calculate The Aspect Ratio Of The Window
glMatrixMode GL_MODELVIEW ' Select The Modelview Matrix
glLoadIdentity ' Reset The Modelview Matrix
'glEnable GL_ALPHA_TEST
glEnable GL_DEPTH_TEST
'Transparent-OpenGL-window
'glEnable GL_BLEND
'glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
glClearColor 0, 0, 0, 0
Do
RenderScene
Sleep 1
Loop While InKey = ""
|