Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi There!

I'm trying to draw non rectangular 2D shapes (polygons, ellipses) with open gl es in .net cf, which are textured with gradients. I thought that i could create the gradient by drawing a rectangle with its vertices colored and than use that rectangle as a texture on the actual shapes. The only problem is that i can find a working code snippet that show how to render an opengl scene onto a Texture or Image (Bitmap) object.
The gradients has to be dynamic so loading them from file is out of the question, i have to create them in run time.

Please guide me to the right direction.
Thx in advance: Bali
Posted

This[^] NeHe article (among other things) shows you how to render to a texture. The basic procedure is to set the viewport to the size of the texture then render whatever you need, and finally to copy your screen buffer to the texture using glCopyTexImage2D.

If you need to update the texture every frame you'd be better off avoiding the copy to texture and rendering straight onto the texture using FBOs (Frame Buffer Objects) which is demonstrated Here[^] but it's a little more complicated.
 
Share this answer
 
Thank you for the answer, I'll try it out.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900