Skip to main content
gamedev.net
🔒 Locked

Texture update

Started by Bouga May 8, 2004 at 12:55 PM 7 replies 350+ views
Original Post
Bouga
Bouga
Is there a way to quickly update a texture that has already been created and built with gluBuild2DMipmaps for example?
"A screen buffer is worth a thousand char's" - me
Ostsol
Ostsol
Only problem there is that the mip-maps aren''t automatically updated.
-Ostsol
Raduprv
Raduprv
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...
_the_phantom_
_the_phantom_
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
Ostsol
Ostsol
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.
-Ostsol
Bouga
Bouga
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.
"A screen buffer is worth a thousand char's" - me

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.