本文整理汇总了Java中com.jogamp.opengl.GL2.glTranslated方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glTranslated方法的具体用法?Java GL2.glTranslated怎么用?Java GL2.glTranslated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glTranslated方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(GLAutoDrawable drawable)
{
inst.stepGame();
GL2 gl = drawable.getGL().getGL2();
gl.glLoadIdentity();
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
if(inst.GAME_STARTED)
setCamera(gl, glu);
else
setCameraMapping(gl, glu);
drawMapGeometry(gl);
drawEnts(gl);
if(Shoot.DEBUG || !inst.GAME_STARTED)
drawGraph(gl);
gl.glTranslated((inst.getPlayerPos().x + inst.getOffset().x), (inst.getPlayerPos().y + inst.getOffset().y), 0);
drawPlayerInfo(gl);
}
示例2: paintCovarianceEllipse
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected static void paintCovarianceEllipse( double[] pos, double[][] cov, final double nsigmas, float[] color, GL2 gl )
{
final int no_points_ellipse = 12;
final double a = cov[0][0];
final double b = cov[1][0];
final double c = cov[1][1];
final double d = Math.sqrt( (((a*a) + (4*b*b)) - (2*a*c)) + (c*c) );
final double scale1 = Math.sqrt( 0.5 * ( a+c+d ) ) * nsigmas;
final double scale2 = Math.sqrt( 0.5 * ( (a+c)-d ) ) * nsigmas;
final double theta = (0.5 * Math.atan2( (2*b), (a-c) ) * 180.0) / Math.PI;
gl.glPushMatrix();
gl.glTranslated(pos[0], pos[1], 0);
gl.glRotated(theta, 0, 0, 1);
gl.glScaled(scale1, scale2, 1);
gl.glColor3f( color[0], color[1], color[2] );
gl.glLineWidth(2);
gl.glBegin(GL.GL_LINE_LOOP);
final double angle = (2*Math.PI) / no_points_ellipse;
for (int i = 0;i<no_points_ellipse;i++) {
gl.glVertex2d( Math.cos( i*angle ), Math.sin( i*angle ) );
}
gl.glEnd();
gl.glPopMatrix();
}
示例3: paintKalmanFilterState
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected static void paintKalmanFilterState( final LabyrinthBallKalmanFilter filter, GL2 gl, float[] covColor, float[] speedColor )
{
final double[] mu = filter.getMu();
final double[][] Sigma = filter.getSigma();
paintCovarianceEllipse( mu, Sigma, 3, covColor, gl );
double velx = mu[2] * 0.1;
double vely = mu[3] * 0.1;
gl.glColor3f( speedColor[0], speedColor[1], speedColor[2] );
gl.glLineWidth(2);
gl.glPushMatrix();
gl.glTranslated(mu[0], mu[1], 0);
gl.glBegin(GL.GL_LINES);
gl.glVertex2d(0, 0);
gl.glVertex2d(velx, vely);
gl.glEnd();
gl.glPopMatrix();
gl.glLineWidth(1);
gl.glColor3f(1,1,1);
gl.glBegin(GL.GL_LINES);
gl.glVertex2d(64, 64);
gl.glVertex2d(mu[0], mu[1]);
gl.glEnd();
}
示例4: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Draw the chart view onto OpenGL drawable.
* The chart is drawn in the rectangular area [0, 0, width-1, height-1].
*/
@Override
public void display(GLAutoDrawable drawable) {
drawable.getContext().makeCurrent();
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
// title
titleRenderer.beginRendering(getWidth(), getHeight());
titleRenderer.setColor(getForeground());
titleRenderer.draw(title, titleArea.x, titleArea.y);
titleRenderer.endRendering();
// decoration (axes, etc.)
drawDecoration(gl);
/* draw body */
gl.glTranslated(bodyArea.x, bodyArea.y, 0);
gl.glScaled(bodyArea.width, bodyArea.height, 1);
// draw background
gl.glCallList(gridId);
/* draw series */
for (Category category : categories) {
category.draw(gl);
}
}
示例5: applyTransform
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Applies the given transform to the given OpenGL files.
*
* @param gl the OpenGL files
* @param t the transform
*/
public static final void applyTransform(GL2 gl, Transform t) {
Vector2 tr = t.getTranslation();
// apply the translation
gl.glTranslated(tr.x, tr.y, 0.0);
// apply the rotation (remember that OpenGL expects degrees not radians)
gl.glRotated(Math.toDegrees(t.getRotation()), 0.0, 0.0, 1.0);
}
示例6: drawCube
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void drawCube(GL2 gl, double r, double x, double y, double z)
{
gl.glPushMatrix();
gl.glTranslated(x, y, z);
gl.glBegin(GL2.GL_QUADS);
gl.glNormal3d(0, 0, -1);
gl.glVertex3d(-r, -r, -r);
gl.glVertex3d(+r, -r, -r);
gl.glVertex3d(+r, +r, -r);
gl.glVertex3d(-r, +r, -r);
gl.glNormal3d(0, 0, 1);
gl.glVertex3d(-r, -r, +r);
gl.glVertex3d(+r, -r, +r);
gl.glVertex3d(+r, +r, +r);
gl.glVertex3d(-r, +r, +r);
gl.glNormal3d(0, -1, 0);
gl.glVertex3d(-r, -r, -r);
gl.glVertex3d(+r, -r, -r);
gl.glVertex3d(+r, -r, +r);
gl.glVertex3d(-r, -r, +r);
gl.glNormal3d(0, 1, 0);
gl.glVertex3d(+r, +r, -r);
gl.glVertex3d(-r, +r, -r);
gl.glVertex3d(-r, +r, +r);
gl.glVertex3d(+r, +r, +r);
gl.glNormal3d(1, 0, 0);
gl.glVertex3d(+r, -r, -r);
gl.glVertex3d(+r, +r, -r);
gl.glVertex3d(+r, +r, +r);
gl.glVertex3d(+r, -r, +r);
gl.glNormal3d(-1, 0, 0);
gl.glVertex3d(-r, -r, -r);
gl.glVertex3d(-r, +r, -r);
gl.glVertex3d(-r, +r, +r);
gl.glVertex3d(-r, -r, +r);
gl.glEnd();
gl.glPopMatrix();
}