tags:

views:

1356

answers:

3

Hi guys, I'm really new to OpenGL, which is a really bad thing to me :| I need to draw a star(sort of) with openGl but I'm not really sure where I should start.

The results should be something like this: http://i29.tinypic.com/68zif8.gif Is there an easy way to do this ?

Thank you !

+2  A: 

Hi, the easiest way would be to draw a texture mapped quad with a "star" texture. You can read a tutorial on texture mapping here: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06

That tutorial teaches how to draw a cube using textures. You just have to draw a single face, instead of all six.

The tutorial is written in C++, but near the end you can download the source of a Delphi version.

There are other effects you might want to add later, such as transparency. You can also read about that in the NeHe site. It has a lot of useful tutorials on OpenGL. It's a great place to learn OpenGL.

Idex
the problem is that I don't want to draw a texture mapped quad :|All needs to be done with coding, no images needs to be used, I need this because I do need to change the light level.Thank you for your answer !
Andy
Then you better get a different example. The image you show _looks_ like a textured quad, not like polygonal data. The texture itself could of course be generated from code, but that's completely unrelated to OpenGL. Can you perhaps provide us with a better example of what you really want to achieve?
Paul-Jan
+1  A: 

If you're new to OpenGL and if you're using Delphi, then most probably what you need is GLScene. Mature, alive, very good quality of code and, of course, free.

I tried GLScene but I still cant find a way to avoid using mapped textures, I suppose this isnt so easy to do.
Andy
Ask them: news://forums.talkto.net/glscene.general- or -news://forums.talkto.net/glscene.supportAt the time of writing are '59884 messages' in glscene.general. (I don't counted them, my Thunderbird says so :-))HTH,
A: 

Why not write an algorithm to generate a texture procedurally in code using a 2D GLuByte array as in the "checker.c" example in Redbook? Instead of following a perfect checkerboard pattern, figure out how to make a 2D texture of that star and map it into a quad using glTexImage2D(...).

bkritzer