本文整理汇总了Java中com.jogamp.opengl.GL2.glRotatef方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glRotatef方法的具体用法?Java GL2.glRotatef怎么用?Java GL2.glRotatef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glRotatef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawBox
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void drawBox(GL2 gl, int x, int y, int sx, int sy, float angle) {
final float r2d = (float) (180 / Math.PI);
gl.glPushMatrix();
gl.glTranslatef(x, y, 0);
gl.glRotatef(angle * r2d, 0, 0, 1);
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(-sx, -sy);
gl.glVertex2i(+sx, -sy);
gl.glVertex2i(+sx, +sy);
gl.glVertex2i(-sx, +sy);
}
gl.glEnd();
if (dynamicAngleEnabled) {
gl.glBegin(GL.GL_LINES);
{
gl.glVertex2i(0, 0);
gl.glVertex2i(sx, 0);
}
gl.glEnd();
}
gl.glPopMatrix();
}
示例2: drawBox
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void drawBox(GL2 gl, float centerX, float centerY, float width, float height, float angle) {
final float r2d = (float) (180 / Math.PI);
final float w = width/2, h = height/2;
gl.glTranslatef(centerX, centerY, 0);
if(angle!=0) gl.glRotatef(angle * r2d, 0, 0, 1);
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2f(-w, -h);
gl.glVertex2f(+w, -h);
gl.glVertex2f(+w, +h);
gl.glVertex2f(-w, +h);
}
gl.glEnd();
}
示例3: drawEllipse
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void drawEllipse(GL2 gl, float centerX, float centerY, float radiusX, float radiusY, float angle, int N) {
final float r2d = (float) (180 / Math.PI);
gl.glTranslatef(centerX, centerY, 0);
if(angle!=0) gl.glRotatef(angle * r2d, 0, 0, 1);
gl.glBegin(GL.GL_LINE_LOOP);
{
for (int i = 0; i < N; i++) {
double a = ((float) i / N) * 2 * Math.PI;
double cosA = Math.cos(a);
double sinA = Math.sin(a);
gl.glVertex2d(radiusX * cosA, radiusY * sinA);
}
}
gl.glEnd();
}
示例4: glAnnotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Shows the transform on top of the rendered events.
*
* @param gl the OpenGL context.
*/
private void glAnnotate(GL2 gl) {
// this whole annotation is translated by the enclosing filter SceneStabilizer so that
// clusters appear on top of tracked features.
int sx2 = chip.getSizeX() / 2, sy2 = chip.getSizeY() / 2;
// draw translation
gl.glPushMatrix();
gl.glTranslatef(-translation.x + sx2, -translation.y + sy2, 0);
gl.glRotatef((float) ((-rotationAngle * 180) / Math.PI), 0, 0, 1);
// gl.glTranslatef(sx2, sy2, 0);
// draw translation
gl.glLineWidth(2f);
gl.glColor3f(0, 1, 1);
gl.glBegin(GL.GL_LINES);
gl.glVertex2f(-sx2, 0);
gl.glVertex2f(sx2, 0);
gl.glVertex2f(0, -sy2);
gl.glVertex2f(0, sy2);
gl.glEnd();
gl.glPopMatrix();
if (isUseVelocity()) {
gl.glBegin(GL.GL_LINES);
float x = (velocityPPt.x / 10) + sx2, y = (velocityPPt.y / 10) + sy2;
gl.glVertex2f(sx2, sy2);
gl.glVertex2f(x, y);
gl.glEnd();
}
}