Sign in to follow this  
ChaseRLewis

OpenGL glGenerateMipMap ?

Recommended Posts

So coming from DirectX trying to teach myself OpenGL. I"m using the SuperBible 5th edition book and up till texturing it's been doing fine. However, I'm noticing a few functions they use in this chapter don't see to be in any of the libraries I downloaded.

It mentions a glGenerateMipMap(GLenum enum) that don't exist in any OpenGL library I've tried.

So basically how should I go about generating mipmaps? gluBuild2DMipMap?

Share this post


Link to post
Share on other sites
Maybe you mean glGenerateMip[b]m[/b]ap? (lowercase m)

http://www.opengl.org/sdk/docs/man3/xhtml/glGenerateMipmap.xml

I believe this function has replaced gluBuild (I think it's faster and leverages the GPU in some way, glu was just a utility function that probably did everything locally on the cpu). I'm purely guessing though.

Share this post


Link to post
Share on other sites
Also, that function won't be in the library, but must be dynamically loaded (using wglGetProcAddress on Windows), as must all other newer OpenGL functionality. You can use a library such as for example [url="http://glew.sourceforge.net/"]GLEW[/url] to make this easier.

Share this post


Link to post
Share on other sites
[quote name='Erik Rufelt' timestamp='1298236522' post='4776792']
Also, that function won't be in the library, but must be dynamically loaded (using wglGetProcAddress on Windows), as must all other newer OpenGL functionality. You can use a library such as for example [url="http://glew.sourceforge.net/"]GLEW[/url] to make this easier.
[/quote]

Ya i've been using GLEW,the book hasn't mentioned anything about dynamically loading specific functions. Probably a fairly basic question, but how do I go about loading that function?

Share this post


Link to post
Share on other sites
If you're using GLEW you don't need to dynamically load it - it should already be available. That's the whole point of GLEW. Can you check that you called glewInit after initializing your context?

(As an aside, I personally prefer generating mipmaps by hand as I find that a simple box filter gives the best results for them, whereas with any autogen method you don't really have control over the filter type being used.)

Share this post


Link to post
Share on other sites
[quote name='ChaseRLewis' timestamp='1298235883' post='4776788']
So coming from DirectX trying to teach myself OpenGL. I"m using the SuperBible 5th edition book and up till texturing it's been doing fine. However, I'm noticing a few functions they use in this chapter don't see to be in any of the libraries I downloaded.

It mentions a glGenerateMipMap(GLenum enum) that don't exist in any OpenGL library I've tried.

So basically how should I go about generating mipmaps? gluBuild2DMipMap?
[/quote]

The glGenerateMipmap() function was originally introduced in the GL_EXT_framebuffer_object extension. glGenerateMipmap() has been part of the core API since OpenGL 3.0.

In your learning you might see some sources telling you to use the GL_GENERATE_MIPMAP flag to the glTexParameteri() function to generate your mipmaps. Don't do that because that's been deprecated since OpenGL 3.0.

Share this post


Link to post
Share on other sites
All the info is here
http://www.opengl.org/wiki/Common_Mistakes#Automatic_mipmap_generation
http://www.opengl.org/wiki/Common_Mistakes#gluBuild2DMipmaps

and if you are new
http://www.opengl.org/wiki/Getting_started

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this