Page 1 of 1

opengl version

Posted: Sun Nov 16, 2025 5:17 pm
by naf
Hi, I am busy writing shaders. I need to check which version of openGL is available in purebasic and found no info on that at all. Can someone clarify that please?
I use PB 6.21 (x64) on linux Zorin. I need a minimum of openGL 4.5 . The hardware goes up to 4.6 .
glfw has GLFW_VERSION_MAJOR and GLFW_VERSION_MINOR, at context creation. Can we access that from PB ?

Re: opengl version

Posted: Mon Nov 17, 2025 7:22 pm
by Shardik
Up to PB 6.12 it was possible to let Ogre generate a debug log and read the Ogre version from that log. I have already posted a cross-platform example here which gets the Ogre version and displays it.

Unfortunately beginning with PB 6.20 the Ogre debug log always remains empty. I therefore have already posted this bug report.

Re: opengl version

Posted: Sat Nov 22, 2025 9:17 am
by pjay
If you're using PBs OpenGLgadget(), then you could try the code below (from Win x64, but may work in Linux):

Code: Select all

OpenWindow(0,0,0,640,480,"")
OpenGLGadget(0,0,0,640,480)
Define version.s, major.l, minor.l
version = PeekS(glGetString_(#GL_VERSION),-1,#PB_Ascii)
#GL_MAJOR_VERSION = $821B
#GL_MINOR_VERSION = $821C
glGetIntegerv_(#GL_MAJOR_VERSION, @major); 
glGetIntegerv_(#GL_MINOR_VERSION, @minor); 
Debug version
Debug major
Debug minor

Re: opengl version

Posted: Sat Nov 22, 2025 10:59 am
by miso
You can use any available opengl shader version, the restriction will be on the hardware that runs it. Is it necessary to be able to execute on older cards, or you are fine with only with the latest/more recent cards.