Verfasst: 02.11.2006 12:46
XIncludeFile "OpenGL.pbi"
Global hWnd.l
OpenWindow(0, 0, 0, 500, 400,"",#PB_Window_SystemMenu )
hWnd = WindowID(0)
pfd.PIXELFORMATDESCRIPTOR
hDC = GetDC_(hWnd)
pfd\nSize = SizeOf(PIXELFORMATDESCRIPTOR)
pfd\nVersion = 1
pfd\dwFlags = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
pfd\iLayerType = #PFD_MAIN_PLANE
pfd\iPixelType = #PFD_TYPE_RGBA
pfd\cColorBits = 24
pfd\cDepthBits = 32
pixformat = ChoosePixelFormat_(hDC, pfd)
SetPixelFormat_(hDC, pixformat, pfd)
hrc = wglCreateContext_(hDC)
wglMakeCurrent_(hDC, hrc)
glClearColor_(0.0, 0.0, 1.0, 1.0)
Repeat
glClear_(#GL_COLOR_BUFFER_BIT)
SwapBuffers_(hDC)
Event = WindowEvent()
If Event = #PB_Event_CloseWindow
End
ElseIf Event = 0
Else
Delay(5)
EndIf
ForEver
Screen öffnen, und anstelle von WindowID() ScreenID() schreiben
Global hWnd.l
OpenWindow(0, 0, 0, 500, 400,"",#PB_Window_SystemMenu )
hWnd = WindowID(0)
pfd.PIXELFORMATDESCRIPTOR
hDC = GetDC_(hWnd)
pfd\nSize = SizeOf(PIXELFORMATDESCRIPTOR)
pfd\nVersion = 1
pfd\dwFlags = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
pfd\iLayerType = #PFD_MAIN_PLANE
pfd\iPixelType = #PFD_TYPE_RGBA
pfd\cColorBits = 24
pfd\cDepthBits = 32
pixformat = ChoosePixelFormat_(hDC, pfd)
SetPixelFormat_(hDC, pixformat, pfd)
hrc = wglCreateContext_(hDC)
wglMakeCurrent_(hDC, hrc)
glClearColor_(0.0, 0.0, 1.0, 1.0)
Repeat
glClear_(#GL_COLOR_BUFFER_BIT)
SwapBuffers_(hDC)
Event = WindowEvent()
If Event = #PB_Event_CloseWindow
End
ElseIf Event = 0
Else
Delay(5)
EndIf
ForEver
Screen öffnen, und anstelle von WindowID() ScreenID() schreiben