Real Software Forums
http://forums.realsoftware.com/

Get OpenGL Version on Windows 7 [Solved]
http://forums.realsoftware.com/viewtopic.php?f=4&t=45422
Page 1 of 1

Author:  eugenedakin [ Sun Sep 23, 2012 12:51 pm ]
Post subject:  Get OpenGL Version on Windows 7 [Solved]

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

Author:  timhare [ Sun Sep 23, 2012 4:05 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

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.

Author:  eugenedakin [ Sun Sep 23, 2012 4:52 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

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

Author:  timhare [ Sun Sep 23, 2012 5:10 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

It's an integer, not a single. Try

GetMajor.Int32Value(0)

Author:  eugenedakin [ Mon Sep 24, 2012 8:36 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

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

Author:  timhare [ Mon Sep 24, 2012 10:09 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

How is agl.aglGetVersion defined? Can you share that code?

Author:  mauitom [ Mon Sep 24, 2012 11:04 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

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.

Author:  timhare [ Mon Sep 24, 2012 11:20 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

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?

Author:  mauitom [ Tue Sep 25, 2012 1:30 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

Oops, yes, you're right, sorry.

Author:  eugenedakin [ Tue Sep 25, 2012 9:07 pm ]
Post subject:  Re: Get OpenGL Version on Windows 7

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

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/