Hi,
I’m learning to use JOGL in my programs and I have a following question. Do I have to create a new GLUquadric object for every sphere that I wish to draw? That is, if I want to draw three spheres using texture mapping do I have to create three GLUquadrics also?
And could someone tell me what is wrong in the following code (it draws only white spheres, not texture mapped):
public void display(GLDrawable arg0) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity(); // Reset The View
gl.glTranslatef(0.0f, 0.0f, -5.0f);
// Draws a sphere
Set coords = sphereCoords.keySet();
for (Iterator iter = coords.iterator(); iter.hasNext();) {
Point centerPoint = (Point) iter.next();
GLUquadric quadric = (GLUquadric) sphereCoords.get(centerPoint);
gl.glBindTexture(GL.GL_TEXTURE_2D, texture[0]);
gl.glTranslatef(centerPoint.getX(), centerPoint.getY(), -5.0f);
glu.gluSphere(quadric, 1.3f, 32, 32);
}
}
I have created GLUquadric for every sphere so the problem isn’t there.