PDA

View Full Version : 3D Objects



glbeginner
01-07-2001, 07:34 AM
Hello there! How to draw 3D objects (Cube, Sphere, etc) by using OpenGL? I use glutSolidSphere (50.0, 200.0, 160.0); to draw a sphere but it looks like a circle, why? Do I need to use Light? Can you please show me the code of creating a 3D sphere? Thanks.

Glossifah
01-07-2001, 10:16 AM
You aren't setting up your worldspace correctly. Read up on gluPerspective or glOrtho on how to specify near and far clipping planes and create depth in a scene.

There is another thread, with someone who had the same problem here: http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/002457.html

Glossifah

coco
01-07-2001, 08:59 PM
Most likelly you have lighting disabled, so you see the sphere in a solid, flat color (like a circle). Do this to start:

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0,GL_POSITION,your_position_vect or);

Read about these commands.

glbeginner
01-07-2001, 10:20 PM
Thanks for giving me the information. http://www.opengl.org/discussion_boards/ubb/smile.gif

grady
01-07-2001, 10:45 PM
I read your question and started to wonder - hey i wonder what the hell his problem is-. (i'm sort of not new, but i don't practice enough so i don't know anything anyway) so i started playing around with the glutsphere (mine didn't look 3d at first either) and spent a whole afternoon making some program. anyway. its all simple and you might get something out of it, if you want it i'll email it to you.

it does
spotlights
modelview matrix rotations/translations
specular highlights
mouse and keybard input with glut
switch the scene to solid wire frame or point drawing mode
triangle strips, colors, normals

blah blah blah

it might be helpful if your real real new.