Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#OpenGLdrawing
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 3:26am
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 840
1 OriginalGriff 437
2 Abhinav S 303
3 thatraja 215
4 Emre Ataseven 200
0 Sergey Alexandrovich Kryukov 8,122
1 OriginalGriff 4,520
2 Peter Leow 3,744
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 18 Aug 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid