how to draw to OpenGL texture

I would like to be able to draw to a texture that already exists if possible.

As a secondary option, to create a new image and use it to create an OpenGL texture (I think I could figure out #2 on my own, but prefer #1).

Does anyone have any information about drawing to existing textures?

My immediate goal is to create a mini-map for a randomly generated map, so the mini-map graphics needs to be created dynamically. I'm thinking of only plotting single pixels for the mini-map, not drawing images onto it.

You could use an FBO (look on this forum for code how to do it), draw your original texture into it on a quad and then draw your dynamically generated graphics on top of it. Do this once and then bind it as a texture.

To draw a mini map pixel by pixel where each pixel is rendered because of how some world map looks, you could have a size 1 polygon with a white texture on it and then use glColor4f to set the color. Then draw that pixel AxB times where a and b are your minimap dimensions. This would create a lot of polygons so I don't know if its a good way to do it or not.

saltwater Wrote:You could use an FBO (look on this forum for code how to do it), draw your original texture into it on a quad and then draw your dynamically generated graphics on top of it. Do this once and then bind it as a texture.

A quick forum search on "FBO" turned up nothing. I don't know what that stands for.

I'll probably end up just creating a graphics context, drawing to it, then making a texture out of it. I was hoping there would be an easy way to draw on an existing texture so I could re-use a small section of an existing larger texture, so I have less textures being used overall.

I'll probably end up just creating a graphics context, drawing to it, then making a texture out of it. I was hoping there would be an easy way to draw on an existing texture so I could re-use a small section of an existing larger texture, so I have less textures being used overall.