A small correction: You can make a sphere out of Quads AND Triangles(or just Triangles).
Also, there are two main kinds of spheres: "normal" ones(I don''t know the technical name) and "geospheres". geosphere''s are usually used in games, and can only be made with triangles.
Hey....... I only want to do a ball in a PONG game and I want an exemple of gluSphere (C++) I seen in the MSDN but I don''t understand how to use it.....
void gluSphere( GLUquadricObj *qobj, GLdouble radius, GLint slices, GLint stacks );
slices and stacks are the number of line in the ball vertical and horizontal, radius is the size but qobj?
void gluSphere( GLUquadricObj *qobj, GLdouble radius, GLint slices, GLint stacks );
slices and stacks are the number of line in the ball vertical and horizontal, radius is the size but qobj?
|
That is coming straight out of NeHe tutorial 18 on quadratics and there may be something that is missing in there.
quote:
by GLUT u mean the glu functions?
I think nate means the functions contained in the GLUT.H header file.
Edited by - oglman on October 16, 2000 10:19:59 PM
You can do it yourself:
You have to replace the 8 and 16 values with the amount of vertices you want.
Does someone know how to calculate a sphere with even-sized polygons? Or have a link to some interresting stuff about this?
|
You have to replace the 8 and 16 values with the amount of vertices you want.
Does someone know how to calculate a sphere with even-sized polygons? Or have a link to some interresting stuff about this?
![](http://baskuenen.cfxweb.net/images/title.jpg)
Will that code right there run faster than Glusphere with Backface culling enabled?
sinistrx: To be honest - I don''t have a clue ![](wink.gif)
I don''t know much about glut, so I can''t say what is faster...
But glut is just another OpenGL wrapper. I don''t want to start a war about this, it''s just that personally I like to stay as low level as I can. Maybe others do too - that''s why I posted this answer.
![](wink.gif)
- But the code can be optimized. Just a few:
- Calc the sin/cos only once. Also every other value used twice or more, can be calced only once.
- Do it in assembly.
- Use floats - not doubles.
- Unrolled loops in some situations (hehe - just kidding
)
- Don''t multiply but interpolate using pre-calculated values.
- Optimisation is endless work...
- Calc the sin/cos only once. Also every other value used twice or more, can be calced only once.
- Just a few reasons why this code could be faster:
- More calculations can be pre-calculated because. For instance: the size/position/slices can be a constant.
- You don''t need an extra glTranslate().
- More calculations can be pre-calculated because. For instance: the size/position/slices can be a constant.
- Another advantage:
- You can enter your own glTexCoord() and/or glColor() values.
- It''s fun to do it yourself
- You can add other strange effects...!
- You can enter your own glTexCoord() and/or glColor() values.
I don''t know much about glut, so I can''t say what is faster...
But glut is just another OpenGL wrapper. I don''t want to start a war about this, it''s just that personally I like to stay as low level as I can. Maybe others do too - that''s why I posted this answer.
![](http://baskuenen.cfxweb.net/images/title.jpg)
I was just telling him how to use gluSphere() not suggesting anything about hoe efficiant it is
the source of glut is included with the distribution so u can have a looksy to see what glutsolidsphere does
also check out the mesa source
http://members.xoom.com/myBollux
also check out the mesa source
http://members.xoom.com/myBollux
Where can I download the SDK and the runtime for OpenGL? Thanks!
-------------------------------
I'll screw up whoever screws around with the gamedev forum!
..-=gLaDiAtOr=-..
-------------------------------
I'll screw up whoever screws around with the gamedev forum!
..-=gLaDiAtOr=-..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement