0

I just read from question #6663300 that glut functions are not proper and I should use glu drawing primitives instead of glut ones.

so I have some qustions about how GLUquadricObj should be used. Everywhere I go, GLUquadricObj is usually used as a pointer and then have new instance created and destroyed at the end of 1 drawing phase. is there any given time where GLUquadricObj is used without pointer so that you pass reference of the GLUquadricObj into functions like gluCylinder?

for the 2nd question, say I have a continuously updated animation that goes on forever until he program closes, should I create and delete GLUquadricObj for every single frame drawn? or can I just leave a single GLUquadricObj craeted, and then delete it when the program closes? do I need to use a drawing list if I want to keep only 1 GLUquadricObj pointer through out the entire animation?

GLUquadricObj *qobj = 0; qobj = gluNewQuadric();

gluCylinder(qobj, CylinderRadius, CylinderRadius, length, Slices, stacks);

gluDeleteQuadric(qobj);

is it any more efficient to have the GLUquadricObj being global rather than local? or should I just leave GLUquadricObj being created and destroyed within a drawn frame?

TopTierTracker
  • 487
  • 1
  • 6
  • 10

1 Answers1

0

is there any given time where GLUquadricObj is used without pointer so that you pass reference of the GLUquadricObj into functions like gluCylinder?

I don't think so. declaring a GLUquadricObj variable probably doesn't set its internal state correctly, so don't do it. (although i haven't looked at the glu source so i can't say for sure)

is it any more efficient to have the GLUquadricObj being global rather than local?

Probably very slightly.

or should I just leave GLUquadricObj being created and destroyed within a drawn frame?

Yes. Don't worry about efficiency if you are only learning opengl, the difference this change would make is completely undetectable. Just leave it the way it is.

Slicedpan
  • 4,995
  • 2
  • 18
  • 33