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.
Thanks...
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.
Thanks...
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.
Gillissie Wrote: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.
http://en.wikipedia.org/wiki/Framebuffer_Object
Argh, sorry about that, the search on this forum is the worst, it makes you wait 45 seconds between searches and it doesn't find anything.
Anyway I found the post using google and site:idevgames.com:
http://www.idevgames.com/forum/showthread.php?t=17125
There is also an article on gamedev.net explaining it better. It's written for regular OpenGL but replacing the EXT by OES in the function names (in regular OpenGL FBOs are an extension, in OpenGL ES not)
http://www.gamedev.net/reference/article...le2331.asp
Anyway I found the post using google and site:idevgames.com:
http://www.idevgames.com/forum/showthread.php?t=17125
There is also an article on gamedev.net explaining it better. It's written for regular OpenGL but replacing the EXT by OES in the function names (in regular OpenGL FBOs are an extension, in OpenGL ES not)
http://www.gamedev.net/reference/article...le2331.asp
saltwater Wrote:Argh, sorry about that, the search on this forum is the worst, it makes you wait 45 seconds between searches and it doesn't find anything. ...
Don't use the forum search, use Google instead! To localize your Google search to iDevgames, use the "site" command like so:
fbo site:idevgames.com
[edit] Just noticed you already did that.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| opengl es strange 16bit texture scale problem | spuckfunkel | 6 | 7,367 |
Aug 14, 2011 10:44 PM Last Post: headkaze |
|
| Increasing brightness of texture in OpenGL | dsedov | 3 | 4,842 |
Jul 29, 2009 03:00 PM Last Post: arekkusu |
|
| How to draw glowing edges in OpenGL ES | miq01 | 9 | 8,489 |
Mar 29, 2009 11:42 AM Last Post: miq01 |
|
| OpenGl ES Texture Problems | jhbau1000 | 4 | 3,724 |
Mar 24, 2009 02:41 PM Last Post: AnotherJake |
|
| OpenGL - how to draw background image? | SDyer777 | 1 | 5,815 |
Mar 9, 2009 11:17 AM Last Post: AnotherJake |
|

