Java Code Examples for com.jogamp.opengl.GL2#glRotated()
The following examples show how to use
com.jogamp.opengl.GL2#glRotated() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrowHead.java From depan with Apache License 2.0 | 6 votes |
/** * Draws an arrowhead on the given <code>GL</code> instantiation. The actual * shape depends on the Arrowhead object that is being drawn. * * @param gl Graphics object that will draw this object. */ @Override public void draw(GL2 gl) { gl.glPushMatrix(); float[] translate = GLScene.P(translateX, translateY); gl.glTranslatef(translate[0], translate[1], translate[2]); gl.glScalef(scaleX, scaleY, scaleZ); gl.glRotated(rotation * 180 / Math.PI, 0, 0, 1); gl.glBegin(GL2.GL_LINE_STRIP); GLPanel.V(gl, controlPoints[0].x, controlPoints[0].y); GLPanel.V(gl, controlPoints[1].x, controlPoints[1].y); GLPanel.V(gl, controlPoints[2].x, controlPoints[2].y); // check if there exists 4 points before drawing the 4th point if (controlPoints.length == 4) { GLPanel.V(gl, controlPoints[3].x, controlPoints[3].y); } GLPanel.V(gl, controlPoints[0].x, controlPoints[0].y); gl.glEnd(); gl.glPopMatrix(); }
Example 2
Source File: ArrowHead.java From depan with Apache License 2.0 | 6 votes |
/** * Draws and fills an arrowhead on the given <code>GL</code> instantiation. * The actual shape depends on the Arrowhead object that is being drawn. * * @param gl Graphics object that will draw this object. */ @Override public void fill(GL2 gl) { // points must be use with the correct order (2-3-0-1) to use triangle fan. gl.glPushMatrix(); float[] translate = GLScene.P(translateX, translateY); gl.glTranslatef(translate[0], translate[1], translate[2]); gl.glScalef(scaleX, scaleY, scaleZ); gl.glRotated(rotation * 180 / Math.PI, 0, 0, 1); gl.glBegin(GL2.GL_TRIANGLE_FAN); GLPanel.V(gl, controlPoints[2].x, controlPoints[2].y); // check if there exists 4 points before drawing the 4th point if (controlPoints.length == 4) { GLPanel.V(gl, controlPoints[3].x, controlPoints[3].y); } GLPanel.V(gl, controlPoints[0].x, controlPoints[0].y); GLPanel.V(gl, controlPoints[1].x, controlPoints[1].y); gl.glEnd(); gl.glPopMatrix(); }
Example 3
Source File: JPaddle.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glLoadIdentity(); gl.glTranslatef(0f, 0f, -2.0f); gl.glRotatef(rotation, 1f, 0f, 0f); gl.glColor3f(1f, 0f, 0f); gl.glBegin(GL2.GL_POLYGON); gl.glVertex3d(-0.5, 0.3, 0.8); gl.glVertex3d(0.5, 0.3, 0.8); gl.glVertex3d(0.8, 0.7, 0.8); gl.glVertex3d(-0.8, 0.7, 0.8); gl.glEnd(); int paddles = 40; for (int i = 0; i < paddles; i++) { gl.glRotated(360.0 / paddles, 1, 0, 0); gl.glBegin(GL2.GL_POLYGON); gl.glVertex3d(-0.5, 0.3, 0.8); gl.glVertex3d(0.5, 0.3, 0.8); gl.glVertex3d(0.8, 0.7, 0.8); gl.glVertex3d(-0.8, 0.7, 0.8); gl.glEnd(); } rotation -= 0.2f; }
Example 4
Source File: Arrowheads.java From depan with Apache License 2.0 | 5 votes |
/** * Draws a triangular open arrow head on the given <code>GL</code> * instantiation. * * @param gl Graphics object that will draw this object. */ @Override public void draw(GL2 gl) { gl.glPushMatrix(); float[] translate = GLScene.P(translateX, translateY); gl.glTranslatef(translate[0], translate[1], translate[2]); gl.glScalef(scaleX, scaleY, scaleZ); gl.glRotated(rotation * 180 / Math.PI, 0, 0, 1); gl.glBegin(GL2.GL_LINE_STRIP); GLPanel.V(gl, controlPoints[1].x, controlPoints[1].y); GLPanel.V(gl, controlPoints[0].x, controlPoints[0].y); GLPanel.V(gl, controlPoints[2].x, controlPoints[2].y); gl.glEnd(); gl.glPopMatrix(); }