Jump to content
  • Advertisement
Sign in to follow this  
Ashkan

OpenGL Directly accessing mip leves of a texture

This topic is 3807 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

I was wondering if it's possible to directly access mip levels of a texture in OpenGL! This looks pretty straightforward at first glance, but I have yet to find an appropriate solution proportionate to the simplicity of the problem itself. Here's a list of methods that are currently known to me, all of which needs a copy of some form. I'm looking for a function that somehow allows me to lock a mip level of a texture. 1) glGetTexImage(), which downloads the requested mip level into system memory. The worst approach one can choose. 2) Using an FBO to render to the texture as described by zimerman in this thread. Overkill. 3) Using a PBO to allocate a buffer in local video memory and initiating a DMA assisted copy operation afterwards to copy the contents of the desired mip level into the buffer. Best approach so far, but still requires a copy. Am I missing something this obvious or is the functionality surprisingly not available?! Thanks.

Share this post


Link to post
Share on other sites
Advertisement
If you do not want a copy of the texture level but just render with it, I guess you could use GL_TEXTURE_BASE_LEVEL in glTexParameteri to set it to the mipmap level you want to draw with.

I think you'll need to have mipmapping on to make it work. So you'd better set the max level to the same number too.

Otherwise, you'd probably need a copy anyway.

Share this post


Link to post
Share on other sites
Yes, you're right. It just dawned on me that I need a copy anyway. What else am I going to do with a pointer returned from lock() if I'm neither about to write to nor read from it? And both of these operations involve a copy. I think I was so focused on designing the abstraction layer itself (to bring D3D and OGL under the same hood) that I somehow lost the bigger picture.

Thanks.

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!