• Advertisement

Archived

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

Accessing Texture Data

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

How would one go about accessing texture data once it''s been generated in OpenGL? I''m fairly sure it''s possible what with procedural textures and whatnot (or are they precalculated?). At any rate, im doing a simple 2D game with deformable terrain, and i''ve decided that altering the alpha data of my texture is probably the best way to go about doing it. Thanks in advance for any input. -eldee ;another space monkey; [ Forced Evolution Studios ]

::evolve::

Share this post


Link to post
Share on other sites
Advertisement
When you create the texture in the first place, you have to create some image and pass a pointer (let''s call it imgPtr) in to glTexImage2D()... Now, if you want to change that image, here''s what you have to do:

1. First go ahead and modify the raw pixel data pointed to by imgPtr.

2. Use glTexSubImage2D() to tell OpenGL you''ve changed the texture.

Rajan

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hey just a little extending question, is there a fast way to get texture info out of internal opengl like if you do render to a texture so it can be modified?

Share this post


Link to post
Share on other sites
No, once its across the bus and onboard the video card it''s not for you to mess with anymore directly. You can use render_to_texture and use gl calls on it, but you can''t fiddle with it with the CPU and expect any kind half decent speed in most circumstances.

------------
- outRider -

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ok!

Share this post


Link to post
Share on other sites

  • Advertisement