We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
OpenGL Primitives (Read 628 times)
OpenGL Primitives
Jun 26th, 2008, 3:29pm
 
Hi,
I am not very well versed in OpenGL. I would simply like to know how to draw simple primitives.

For example how to draw a series of cones in 3D?
In 'hacks' there is a section called 'More primitives'. Perhaps someone can post a few simple examples. It would be much appreciated.

Thanks
Re: OpenGL Primitives
Reply #1 - Jun 26th, 2008, 4:07pm
 
JOGL actually comes with a class of such things: com.sun.opengl.util.GLUT which has such functions as glutSolidCone(double base, double height, int slices, int stacks) to draw things.

You'll have to wrap it in a beginGL()/engGL() pair though.
Re: OpenGL Primitives
Reply #2 - Jun 26th, 2008, 4:44pm
 
Thanks for your help.

I looked at the jogl documentation, and it seems that this function only allows you to draw a cone around the z axis?

I need to specify a start and an end point in 3D and draw a cone of specific radius between them. Is it possible with that function?
Re: OpenGL Primitives
Reply #3 - Jun 26th, 2008, 4:55pm
 
Or do I draw the Cone around the Z axis and then translate / rotate it?

If so, how would I do that? A small bit of code perhaps, just to get me started?

Thanks.
Re: OpenGL Primitives
Reply #4 - Jun 28th, 2008, 11:21am
 
Out of curiosity, I just looked at the OpenGL examples in PDE. I should study them, I am also an OpenGL newbie.
Anyway, the Shape Transform demo shows how to make a cone out of a pyramid with lot of sides... Not sure if it is good enough.
There is also the surfaceLib, without cone primitive, but you can create it, apparently.
Page Index Toggle Pages: 1