Jump to content
  • Advertisement
Sign in to follow this  
bah

OpenGL OpenGL extensions (glCompressedTexImage2D)

This topic is 4977 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, First, I've never used OpenGL extensions before. I am trying to use "glCompressedTexImage2D" to upload a set of mipmaps from a .dds file to OpenGL. I've already been to http://oss.sgi.com/projects/ogl-sample/registry/ and have downloaded "glext.h" where the function's prototype is located. I placed the following directives at the beginning of the source file, made the call to "glCompressedTexImage2D" and, naturally, got a linker error.
#define GL_GLEXT_PROTOTYPES
#include "glext.h"
Does anyone know where is the code for this function? (the .dll or .lib file) Also, I downloaded the OpenGL Extensions' Viewer by RealTech to verify that the extension is available on my PC but was unable to do so since I don't really know which flag to look for. It might be "GL_ARB_texture_compression" but I am not sure. Finally, is it guaranteed that this functionality will be available if the target machine's OpenGL version is 1.3 or greater? For now, I will only use the function if the host machine's OpenGL version is "1.3" or greater. Thanks

Share this post


Link to post
Share on other sites
Advertisement
The code for the extension is inside the driver, you have to setup the function pointer to use the extension by asking the driver for it. For doing this you can either do it 'by hand' (I'm sure NeHe has a tutorial on it) or use an extension loader which will setup the function pointers for you once you've made an OpenGL context. Personally I use GLee by our very own forum mod [grin] (see OGL Forum FAQ for url to download it)

GL_ARB_texture_compression is indeed the extension which you need. Its best to check if that extension is present before trying to use it, instead of assuming version numbers.

Share this post


Link to post
Share on other sites
I found the tutorial you were probably referring to [Lesson 22. Bump Mapping (Extensions)] and I wrote the following segment:

PFNGLCOMPRESSEDTEXIMAGE2DPROC p = NULL;
const char* string = glGetString( GL_EXTENSIONS );

if( strstr( string, "GL_ARB_texture_compression" ) != NULL )
p = PFNGLCOMPRESSEDTEXIMAGE2DPROC) = wglGetProcAddress("glCompressedTexImage2D");

I should have paid more attention to the SGI link in my previous post. It says that there are two ways to access the functions, "wglGetProcAddress on Windows and glXGetProcAddressARB on Linux."

Thanks for you help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!