Post by (X) on Jan 12, 2024 12:25:49 GMT 1
I created this little function to post/show the OpenGL version in the debug window... Baby steps!
Proc P_OGL_ShowVer
Try
Private Const GL_VERSION As Long = &H1F02
Dim version As String
version = glGetString(GL_VERSION)
Debug.Print "OpenGL version: " & version
Catch
Trace Err$
EndCatch
This seems to be enough to get a version report. It is a part of a Demo by Peter Heinzig. gb32.proboards.com/post/4398
$Library "gfawinx"
$Library "UpdateRT"
UpdateRuntime ' Patches GfaWin23.Ocx
$Library "OpenGL_Lib"
'----- Set up window --------------------------------------------------------
Local n%
Form F0 = "OpenGL-Demo", , , _X, _Y : BackColor = $C0C0C0
For n = 1 To 10 : Ocx Command CO(n) = "Demo " & n, 0, (n - 1) * 25, 60, 25 : Next
Ocx Form F1 = , 60, 0, _X - 60, _Y : .AutoRedraw = 1
Set Me = F1 : DoEvents
'----- OpenGL ------------------------------------------------------------------
INIT_OPENGL_DC 'Initialization OpenGL for the active form (Me)
P_OGL_ShowVer
Sub INIT_OPENGL_DC
'Setzt globale Variable:
Global OpenGL_RDC%, OpenGL_DC% = Me.hDC, SV! = _X / _Y 'SV = Seitenverhältnis von Me
Local pixformat%, ret%, PFD As PIXELFORMATDESCRIPTOR
PFD.nSize = SizeOf(PFD) : PFD.nVersion = 1 : PFD.cColorBits = 32 : PFD.cDepthBits = 16
PFD.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW
PFD.dwLayerMask = PFD_MAIN_PLANE : PFD.iPixelType = PFD_TYPE_RGBA
'PFD.cAccumBits = 32 'bei Bedarf aktivieren
pixformat = ChoosePixelFormat(OpenGL_DC, PFD)
Ocx Form Dummy : OpenGL_DC = Dummy.hDC 'erst mal ein Dummy-Fenster initialisieren,
M1: 'sonst Fehler bei manchen Rechnern
SetPixelFormat(OpenGL_DC, pixformat, PFD)
OpenGL_RDC = wglCreateContext(OpenGL_DC)
ret = wglMakeCurrent(OpenGL_DC, OpenGL_RDC)
If !IsNothing(Dummy) Then Dummy.Close : OpenGL_DC = Me.hDC : GoTo M1 'jetzt Me init.
If !ret Then Message"Initialisierungsfehler" : End
Proc P_OGL_ShowVer
Try
Private Const GL_VERSION As Long = &H1F02
Dim version As String
version = glGetString(GL_VERSION)
Debug.Print "OpenGL version: " & version
Catch
Trace Err$
EndCatch
This is the output...
OpenGL version: 4.0.0 - Build 10.18.10.5161