Global Const $GL_VERSION_1_1 = 1 Global Const $PFD_TYPE_RGBA = 0 Global Const $PFD_MAIN_PLANE = 0 Global Const $PFD_DOUBLEBUFFER = 1 Global Const $PFD_DRAW_TO_WINDOW = 4 Global Const $PFD_SUPPORT_OPENGL = 32 Global Const $GL_PROJECTION = 0x1701 Global Const $GL_COLOR_BUFFER_BIT = 0x00004000 Global Const $GL_TRIANGLES = 0x0004 Func _EnableOpenGL($hwnd, ByRef $hDC) Local $pfd = DllStructCreate("short nSize;" & _ "short nVersion;" & _ "dword dwFlags;" & _ "byte iPixelType;" & _ "byte cColorBits;" & _ "byte cRedBits;" & _ "byte cRedShift;" & _ "byte cGreenBits;" & _ "byte cGreenShift;" & _ "byte cBlueBits;" & _ "byte cBlueShift;" & _ "byte cAlphaBits;" & _ "byte cAlphaShift;" & _ "byte cAccumBits;" & _ "byte cAccumRedBits;" & _ "byte cAccumGreenBits;" & _ "byte cAccumBlueBits;" & _ "byte cAccumAlphaBits;" & _ "byte cDepthBits;" & _ "byte cStencilBits;" & _ "byte cAuxBuffers;" & _ "byte iLayerType;" & _ "byte bReserved;" & _ "dword dwLayerMask;" & _ "dword dwVisibleMask;" & _ "dword dwDamageMask;") Local $h_dc = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hwnd) DllStructSetData($pfd, "nSize", DllStructGetSize($pfd)) DllStructSetData($pfd, "nVersion", $GL_VERSION_1_1) DllStructSetData($pfd, "dwFlags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER)) DllStructSetData($pfd, "iPixelType", $PFD_TYPE_RGBA) DllStructSetData($pfd, "cColorBits", 24) DllStructSetData($pfd, "cDepthBits", 16) DllStructSetData($pfd, "iLayerType", $PFD_MAIN_PLANE) DllOpen("gdi32.dll") DllOpen("opengl32.dll") Local $iFormat = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $h_dc[0], "ptr", DllStructGetPtr($pfd)) Local $iSetFormat = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $h_dc[0], "int", $iFormat[0], "ptr", DllStructGetPtr($pfd)) Local $h_cont = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $h_dc[0]) Local $iRet = DllCall("opengl32.dll", "int", "wglMakeCurrent", "int", $h_dc[0], "int", $h_cont[0]) $hDC = $h_dc[0] Return 1 EndFunc ;==>EnableOpenGL Func _glBegin($mode) DllCall("opengl32.dll", "none", "glBegin", "uint", $mode) EndFunc ;==>glBegin Func _glClear($mask) DllCall("opengl32.dll", "none", "glClear", "uint", $mask) EndFunc ;==>glClear Func _glColor3f($red, $green, $blue) DllCall("opengl32.dll", "none", "glColor3f", "float", $red, "float", $green, "float", $blue) EndFunc ;==>glColor3f Func _glEnd() DllCall("opengl32.dll", "none", "glEnd") EndFunc ;==>glEnd Func _glMatrixMode($mode) DllCall("opengl32.dll", "none", "glMatrixMode", "uint", $mode) EndFunc ;==>glMatrixMode Func _glVertex3f($x, $y, $z) DllCall("opengl32.dll", "none", "glVertex3f", "float", $x, "float", $y, "float", $z) EndFunc ;==>glVertex3f Func _glViewport($x, $y, $width, $height) DllCall("opengl32.dll", "none", "glViewport", "int", $x, "int", $y, "int", $width, "int", $height) EndFunc ;==>glViewport Func _SwapBuffers($hDC) DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC) EndFunc ;==>SwapBuffers