Archived

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

Kilj

per pixel texture modifications?

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