Click here to Skip to main content
13,355,335 members (73,083 online)
Rate this:
Please Sign up or sign in to vote.
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 17-Aug-11 4:26am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Thank you for the answer, I'll try it out.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 18 Aug 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100