OpenGL extensions

Started by
4 comments, last by V-man 14 years, 10 months ago
First off, I'm pretty new to OpenGL extensions and with that said I have several questions along with a problem that I'm currently having with it. And according to my gl.h, I only have 1.1 (yeah... my laptop sucks). #1 Do some extensions eventually make it to the new versions of OpenGL, making it part of the core API? #2 How does the whole set up work? And please correct me if I'm wrong. From what I can see, gl.h just #defines the extension names to 1 if the graphics card supports it and that's it, right? glew.h contains all of the current (assuming I got it off of glew.sourceforge.net) extension function prototypes for ALL versions and some more #define directives. And lastly glew32.lib just contains all of those extension function definitions? #3 How does glew32s.lib differ from glew32.lib? #4 I'm trying to use VBOs and I see that GL_ARB_vertex_buffer_object is not in my gl.h, which is fine. No VBOs for me =(. The problem is that when I checked it by code, it said that it found it? The following is what I use to check if my extensions are available on my graphics card.

CheckOpenGLExtensionSupport( const char *ExtensionName )
{
	char *ExtensionList = (char*)glGetString( GL_EXTENSIONS );

	const unsigned NumCharactersInExtensionList = strlen( ExtensionList );
	unsigned CurrentNumberOfCharacters = 0;

	while( CurrentNumberOfCharacters != NumCharactersInExtensionList )
	{
		const unsigned CurrentExtensionLength = strcspn( ExtensionList+CurrentNumberOfCharacters, " " );
		if( strncmp(ExtensionName, ExtensionList+CurrentNumberOfCharacters, CurrentExtensionLength) == 0 )
			return true;

		CurrentNumberOfCharacters += CurrentExtensionLength+1;
	}
	return false;
}
Does the glGetString operate in gl.h or glew.h? I'm assuming that the GL_ARB_vertex_buffer_object that it found was in glew.h and not the one I was looking for. How do I have glGetString check gl.h if that was the case?
Advertisement
http://www.opengl.org/sdk/docs/man/xhtml/glGetString.xml

Call this with GL_VERSION to see what opengl version you have. Think about it, if you bought a new video card your .h would say version 1.1 when you know your card is 2.0/3.0. That is the core openGL version. Everything else newer is going to be supported in glew as an extension.

"How does glew32s.lib differ from glew32.lib"

Not sure. Shouldnt matter though. I have been using it for a while and haven't needed to investigate that.


"I'm trying to use VBOs and I see that GL_ARB_vertex_buffer_object is not in my gl.h, which is fine. No VBOs for me =(. The problem is that when I checked it by code, it said that it found it?"

Again gl.h is meaningless.

Glew is not some magic that you think it is. What it is doing is asking your video card how to communicate with the newer functionality of gl. So gl.h / glew.h are the same, it's all just the core and extended "interface" to operate openGL on the video card.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

If you are using windows then your core gl version will be 1.1 (maybe 1.2?) even if you have a brand new top of the line video card or great computer. You have Microsoft to thank for not updating its GL version not your laptop. To use anything after 1.1 you need to use extensions.

To answer your question #1 Yes they do.

Question #2:
glext.h defines the extension names. GL.h declares core OpenGL functionality. Your video card capabilities have nothing to do with the content of GL.h or any other gl file. If you attempt to use a function that your video card cannot handle, you will most likely crash. You should do runtime checks to determine your video cards capabilities. GlEW can help you with this.

#3 I've never used GLEW so I dont feel comfortable to answer this but I do know that using GLEW as your extension wrangler will make your life easier.

#4 Just because its not defined in GL.h doesn't mean you cant use vertex buffer objects. It depends on the capabilities of your video card and driver.

Edit: I just want to clarify that I believe glGetString(GL_VERSION) will return the version supported by the video card and your current driver.

I hope this is helpful.
Thanks.
Moved to OpenGL.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
We always recommend Getting Started for newcomers
http://www.opengl.org/wiki

and also, lots of hot information here
http://www.opengl.org/wiki/Common_Mistakes
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement