Solved

3D Cilinder

Posted on 2004-04-26
4
1,207 Views
Last Modified: 2013-12-06
Hi all,

i'm starting with opengl, i would like to draw a 3d cilinder or cube, has anyone a good example about how this is done??

a good resource/starting page would be ok also ,

thanks in advance,

fcco
0
Comment
Question by:fcco
4 Comments
 
LVL 45

Expert Comment

by:sunnycoder
Comment Utility
Hi fcco,

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=05

I highly recommend these tutorials
http://nehe.gamedev.net/

Sunnycoder
0
 

Expert Comment

by:Aeken
Comment Utility
hi, fcco,

u mean that u wan code that generated using open GL library or any openGL code that can generate cube and cylinder?
0
 
LVL 1

Accepted Solution

by:
greg_pendlebury earned 50 total points
Comment Utility
If your using GLU then there are simple functions built in that allow some decent control:

// global variable
GLUquadricObj *quad;

// in your init code
quad = gluNewQuadric();

// To draw a cyclinder
gluCylinder(quad, BASE_WIDTH, TOP_WIDTH, HEIGHT, SLICES, STACKS);

The numbers you choose for slices and stacks reflect how close to a true cyclinder you get. (imagine them as slices of pie around the centre).
SLICES = 3 is a triangular prism
SLICES = 4 is a rectangular prism, or a cube if HEIGHT = BASE_WIDTH = TOP_WIDTH
etc...

higher number of slices gets you closer to a true circular cross section.

Stacks is head up the side of the cylinder. Depending on your shading model you could get a way with having quite a low number here because it won't be curved.

You can play around with your shape by altering BASE_WIDTH and TOP_WIDTH to make frustrams, and pyramids and such.
0
 
LVL 2

Author Comment

by:fcco
Comment Utility
Thanks, that is what i was looking for!

regards,

fcco
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now