Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Texture management strategies?

Reply
Thread Tools

Texture management strategies?

 
 
Ilmari Heikkinen
Guest
Posts: n/a
 
      04-15-2005
Hello, I'm writing this OpenGL engine thing, and am currently wondering
about a good way to manage loading, replacing and disposing of
textures.

It's doable to preload 20 images as rgba data into system memory, but
trying to preload them into GL textures gets very slow. So there's a
need to load textures into GL on the fly and delete unused textures.

This is roughly what I'm currently doing every three seconds in a
slideshow program:

tex_id = renderer.textures[image.texture.object_id]
if tex_id
image_filename = images[counter]
GL.PushAttrib(GL::TEXTURE_BIT)
GL.BindTexture(TEXTURE_2D, tex_id)
bitmap = load_image(image_filename)
GL.TexImage2D(TEXTURE_2D,
0, 4,
bitmap.width, bitmap.height,
0, color_mode, pixel_format,
bitmap.pixels)
GL.PopAttrib()
end

It's not very pretty... Instead of the whole
bindtexture-texsubimage2d-exposing-graphics-API-blah, I'd like to do
this:

image.texture = images[counter]

And have the texture manager take care of disposing unused textures.


image.replace_texture( images[counter] )

Would be an alternative for cases where the texture size stays the same
but the contents change (like with video.)


But I haven't really done this sort of stuff before. Any pointers on
where to start or what would be a good way to do this? Books on the
subject ?


Grateful for any help
- Ilmari



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with texture of UI stacey Java 3 01-23-2007 03:36 PM
texture on my inkjet photo prints gypsy3001@yahoo.com Digital Photography 5 10-12-2005 08:43 AM
Texture mapping in Java 2D! plank@plank.com Java 5 09-02-2005 03:17 PM
Changing CreateQuad() defined Texture - D3D Xpyder C++ 3 03-05-2005 12:09 AM
DiMAGE A2 For Video and Texture Aquisition Tesselator Digital Photography 0 07-08-2004 05:18 PM



Advertisments