• Advertisement

Archived

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

per pixel texture modifications?

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

Hello, I really dont know how to access the image information stored in a texture. I mean, id like to be able to read the color of a pixel and write a color of a pixel in a texture, then eventually resave that texture as a bmp or something. Its for my latest game which is more or less up and running, I would like to let the user modify a ships apperance. Modify the trim and main paint colors. Thank you, obviously this is all in OpenGL !!! Chris Ochoa

Share this post


Link to post
Share on other sites
Advertisement
only solution I can think of involves using a pbuffer to change the texture on the fly
Cant remember the correct details of how you would do it, but its a good place to start

[edited by - _the_phantom_ on July 30, 2002 8:43:50 PM]

Share this post


Link to post
Share on other sites
Just keep the texture data after you''ve loaded it from the file. You can then easily do whatever you want with it (modify it, save it, upload it as a texture, etc.)

Share this post


Link to post
Share on other sites
thats the problem, im dont know what to do to be able to access the texture(after its loaded) as basically an array of colors. If i have to ill write my own bmp loader (i dunno the header yet) and then just resave it, then load it as a texture. Yet I was banking on a simple routine to access the texture data after its loaded. More or less an unrelated question, how do i get direct access to video memory, say if i wanted to save a picture of the screen =). What is the address to start reading at?

chris ochoa.

Share this post


Link to post
Share on other sites
glGetTexImage() gets the data for the currently bound texture.

Im not sure if this allows real-time modifications tho.

[edited by - sark on July 31, 2002 1:42:58 AM]

Share this post


Link to post
Share on other sites
Once you''ve got it, and modified it.. you can make the changes stick by replacing the old unmodified texture data with the modified texture data, using the function:

glTexSubImage2D(level, xoffset, yoffset, width, height, format, type, pixels);

This function replaces the texture data of the currently bound texture.

Hope this helps.

- Weasalmongler

Share this post


Link to post
Share on other sites

  • Advertisement