URL87
URL87

Reputation: 11032

gl.glScalef() hide the gl.glDrawArrays() drawing

I have a program which draw a 3D shape according to set of GL.GL_VERTEX_ARRAY , finally it drawn within the display() method -

public void display(GLAutoDrawable drawable) {
    gl.glDrawArrays(GL.GL_QUADS, 0, 24);
}

so far it work ok and I get the desired shape on the output , but if I add gl.glScalef(20, 20, 40); before the gl.glDrawArrays() the shape stop to be appear and I get blank output -

public void display(GLAutoDrawable drawable) {
    gl.glScalef(20, 20, 40);
    gl.glDrawArrays(GL.GL_QUADS, 0, 24);
}

How could I scale the output correctly ?

Edit:

Fixed by adding gl.glLoadIdentity() before .

Upvotes: 0

Views: 297

Answers (1)

derhass
derhass

Reputation: 45362

It is totally unclear what the rest of your code will do, but from the shown fragments alone, one could suspect that you never reset the matrix, and the scaling accumulates over the course of several frames.

Upvotes: 1

Related Questions