Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Dec 13, 2017 5:58 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Get OpenGL Version on Windows 7 [Solved]
PostPosted: Sun Sep 23, 2012 12:51 pm 
Offline

Joined: Mon Jan 02, 2006 11:43 am
Posts: 172
Location: Calgary, Alberta, Canada
Hello Everyone,

I am attempting to find out the version of OpenGL on my PC with Windows 7, and unfortunately can't seem to find the magic code :)

After looking online, it appears that the code should go something like this:

glGetIntegerv(GL_MAJOR_VERSION, *)
glGetIntegerv(GL_MINOR_VERSION, *)

This looks like it works on GL version 3.0 or greater. I have attempted to prefix the code with OpenGL (as is common with Real Studio for the Windows 7 version), and this command doesn't exist. Chuckle, If the latest version of Windows 7 is less than 3.0, then the command likely doesn't exist.

Edited*
I found a helpful OpenGL Module at http://basic4gl.wikispaces.com/2D+Drawing+in+OpenGL and assembled the following code:
Dim Get_Major as new MemoryBlock(4)
Dim Get_Minor as new MemoryBlock(4)
agl.aglGetVersion(Get_Major, Get_Minor)
Get_Major.Byte(3)=0
MsgBox Get_Major.PString(0)
LblMajor.Text = Get_Major.CString(1)


I am assuming that the major value may be 3.0, and needing to have a terminating byte, I needed 4 bytes. Still no joy.

Does anyone have any thoughts on this?

Thanks for your kind help,

Eugene


Last edited by eugenedakin on Thu Sep 27, 2012 9:43 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Sun Sep 23, 2012 4:05 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Based on the name, glGetIntegerv, I would expect it to return an integer, not a string. That is also consistent with using a 4-byte memoryblock.


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Sun Sep 23, 2012 4:52 pm 
Offline

Joined: Mon Jan 02, 2006 11:43 am
Posts: 172
Location: Calgary, Alberta, Canada
Thanks for the reply Tim!

I reworked the code to this:

Dim Get_Major as new MemoryBlock(4)
Dim Get_Minor as new MemoryBlock(4)
agl.aglGetVersion(Get_Major, Get_Minor)
Get_Major.Byte(3)=0
LblMajor.Text = Cstr(Get_Major.SingleValue(0))


The good news is that I received the number zero, this is a step in the right direction :) I think that the value should be a 2 or a 3.

Are there any other helpful suggestions?

Sincerely,

Eugene


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Sun Sep 23, 2012 5:10 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
It's an integer, not a single. Try

GetMajor.Int32Value(0)


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Mon Sep 24, 2012 8:36 pm 
Offline

Joined: Mon Jan 02, 2006 11:43 am
Posts: 172
Location: Calgary, Alberta, Canada
Palm-of-hand-to-forehead .... thank you for your patience :)

Unfortunately, I am still getting the same value of zero. Just for the fun of it, I attempted many other types, including all of the integer types and I am getting the value of zero. Chuckle, at least its consistent.

Any other helpful suggestions?

Sincerely,

Eugene


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Mon Sep 24, 2012 10:09 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
How is agl.aglGetVersion defined? Can you share that code?


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Mon Sep 24, 2012 11:04 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
This works on a Mac,
// extern void aglGetVersion(GLint *major, GLint *minor)
Declare Sub aglGetVersion Lib "AGL.framework" (ByRef major As Integer, ByRef minor As Integer)
Dim major, minor As Integer
aglGetVersion(major, minor)

You'd have to replace the library "AGL.framework" on your PC, I'm not sure what that would be. My results are 2.0.


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Mon Sep 24, 2012 11:20 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Isn't AGL Mac specific? In order to use glGetIntegerv, you must have a current opengl context. Have you created one before calling this code?


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Tue Sep 25, 2012 1:30 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
Oops, yes, you're right, sorry.


Top
 Profile  
Reply with quote  
 Post subject: Re: Get OpenGL Version on Windows 7
PostPosted: Tue Sep 25, 2012 9:07 pm 
Offline

Joined: Mon Jan 02, 2006 11:43 am
Posts: 172
Location: Calgary, Alberta, Canada
Got it :)

In Windows 7, this shows the string "4.2.0"

LblMajor.Text = glGetString_RB(OpenGL.GL_VERSION)


Just a hint, don't use just glGetString, or you will have nothing (possibly null?).

Thanks for everyone's help and perseverance!

Sincerely,

Eugene


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group