mercredi 7 janvier 2015

Random glTranslate of glutSolidSphere, openGL

Trying to translate a sphere to a random position in space, it just keeps darting around randomly in the allocated 'max' and 'min' random positions, rather than maintaining one position in the randomly allocated space. Below is the method I'm using, with glTranslate:



void drawSphere( float fRadius, int iSlices, int iSegments )
{
glPushMatrix();

glPushAttrib(GL_ALL_ATTRIB_BITS);
glTranslatef(randFloat(1000.0f, 8000.0f), 20.0f, 20.0f);
glEnable(GL_LIGHTING);

glutSolidSphere(fRadius, iSlices, iSegments);
glPopAttrib();
glPopMatrix();
}




Aucun commentaire:

Enregistrer un commentaire