Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Bouga

Texture update

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

Is there a way to quickly update a texture that has already been created and built with gluBuild2DMipmaps for example?

Share this post


Link to post
Share on other sites
Advertisement
Yes, that''s true. I don''t use mip-maps in my engine so I don''t have this problem (nor do I update my textures)
I don''t think there is a way, except for deleting the texture and recreating it again...

Share this post


Link to post
Share on other sites
ah, but there is a way to update :D
there is an extension, supported by probably every card out there called GL_SGIS_generate_mipmap which can be used to generate the mipmaps whenever the base texture is updated.


glBindTexture( GL_TEXTURE2D, tid );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA,
GL_UNSIGNED_BYTE, image[0] );



// Automatic Mipmap Generation for

// Dynamic Textures

// Render some geometry to a buffer.

glBindTexture( GL_TEXTURE2D, tid );
glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS,
GL_TRUE );
glCopyTexSubImage2D( GL_TEXTURE_2D, … );
// Render the scene that utilizes the mipmapped dynamic texture.



for other details do a search on the extension on google, i''m sure it will turn up something

Share this post


Link to post
Share on other sites
Might be. If you delete and recreate the texture, you''re de-allocating and re-allocating video memory. This way, you''re just overwriting existing data.

Share this post


Link to post
Share on other sites
Thanks, I will start trying this out right now. And actually using mipmaps isn''t that important, speed is, so I will probably use regular textures so I dont need to waste time and rebuild mipmaps levels.

Share this post


Link to post
Share on other sites
If you can do without mip-maps, then use glTexSubImage2D(), it''s the fastest way (without using pixel fragments)

Share this post


Link to post
Share on other sites

  • 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!