Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

3D Cilinder

Posted on 2004-04-26
4
Medium Priority
?
1,217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10918176
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
ID: 11087064
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 200 total points
ID: 11255031
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
ID: 11257747
Thanks, that is what i was looking for!

regards,

fcco
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 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