opengl version

Everything related to 3D programming
User avatar
naf
User
User
Posts: 10
Joined: Fri Aug 18, 2023 3:19 pm

opengl version

Post 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 ?
User avatar
Shardik
Addict
Addict
Posts: 2074
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: opengl version

Post 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.
Collection of cross-platform examples with API functions to extend PureBasic
pjay
Enthusiast
Enthusiast
Posts: 282
Joined: Thu Mar 30, 2006 11:14 am

Re: opengl version

Post 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
miso
Enthusiast
Enthusiast
Posts: 506
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: opengl version

Post 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.
Post Reply