本文整理汇总了Java中com.jogamp.opengl.GL2.glLoadIdentity方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glLoadIdentity方法的具体用法?Java GL2.glLoadIdentity怎么用?Java GL2.glLoadIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glLoadIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: reshape
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float)width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
示例3: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
view.update(0);
GL2 gl = g.getGL2(); // get the OpenGL 2 graphics context
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
gl.glClearColor(1f, 1f, 1f, 1);
gl.glLoadIdentity(); // reset the model-view matrix
//Transform by Aim
g.aimCamera(view.getAim());
g.setColor(Color.CYAN);
updateAnimation();
Joint root = motion.getArmature().getRoot();
for (Joint js : root.getChildren()) {
drawSkeleton(g, js);
}
}
示例4: reshape
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float) width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
示例5: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) { //shows the class in the jAER window
if ((drawable == null) || (chip.getCanvas() == null) || !classifyEvents || model == null) {
return;
}
titleRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 40));
Rectangle2D bounds = titleRenderer.getBounds("Unkown");
titleArea = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());
GL2 gl = drawable.getGL().getGL2();
gl.glColor3f(1, 1, 1);
gl.glRasterPos3f(10, 10, 0);
titleRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
titleRenderer.setColor(Color.WHITE);
titleRenderer.draw(String.format("Class: %d", labeledClass), titleArea.x, titleArea.y);
titleRenderer.endRendering();
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glTranslatef(drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() / 2, 0);
gl.glColor3f(1, 1, 1);
float w = drawable.getSurfaceWidth() * lastdot * 5;
gl.glRectf(0, -10, w, 10);
gl.glPopMatrix();
}
示例6: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL 2 graphics context
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
gl.glLoadIdentity(); // reset the model-view matrix
gl.glTranslatef(0.0f, 0.0f, -5.0f); // translate into the screen
gl.glScaled(2, 2, 2);
gl.glRotated(angleY, 0, 1, 0);
g.drawFrustrum(frustrum);
//Draw Bunny Model
bunny.draw(g);
//Draw Bounding Box
gl.glColor3f(0, 1, 1);
renderOctree(g, octree);
//Rotate Model
if(rotate) {
angleY += 1;
}
}
示例7: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Called by the drawable to initiate OpenGL rendering by the
client. After all GLEventListeners have been notified of a
display event, the drawable will swap its buffers if {@link
GLAutoDrawable#setAutoSwapBufferMode setAutoSwapBufferMode} is
enabled. */
@Override
public void display(GLAutoDrawable drawable){
target.update();
GL2 gl=drawable.getGL().getGL2();
gl.glClearColor(0,0,0,0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glPushMatrix();
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity(); // very important to load identity matrix here so this works after first resize!!!
gl.glOrtho(0,drawable.getSurfaceWidth() ,0,drawable.getSurfaceHeight(),10000,-10000);
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glColor3f(1,1,1);
gl.glRectf(target.x()-SIZE, target.y()-SIZE, target.x()+SIZE, target.y()+SIZE);
// gl.glColor3f(1,1,1);
// gl.glTranslatef(target.x(),target.y(),0);
// if(eyeQuad==null) eyeQuad = glu.gluNewQuadric();
// glu.gluQuadricDrawStyle(eyeQuad,GLU.GLU_FILL);
// glu.gluDisk(eyeQuad,0,5,16,1);
gl.glPopMatrix();
}
示例8: reshape
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float) width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, aspect, 0.1, 1000.0); // fovy, aspect, zNear, zFar
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
示例9: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL 2 graphics context
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
gl.glLoadIdentity(); // reset the model-view matrix
gl.glTranslatef(0.0f, 0.0f, -15.0f); // translate into the screen
gl.glScaled(15, 15, 15);
gl.glRotated(angleY, 0, 1, 0);
//Draw Bunny Model
bunny.draw(g);
//Draw Bounding Box
gl.glColor3f(0, 1, 1);
//g.drawBoundingBox(bunnyVBO.getBoundingBox());
renderOctree(g, octree);
//Rotate Model
if (rotate) {
angleY += 1;
}
}
示例10: standardScene
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void standardScene(Graphics3D graphics, int x, int y, int w, int h) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2();
GLU glu = g.getGLU();
gl.glViewport(x, y, w, h);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
double aspect = (double)w/(double)h;
glu.gluPerspective(60.0, aspect, 0.1, 500.0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
}
示例11: reshape
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
gl.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
}
示例12: reshape
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float)width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
double angle = 45;
double nearDistance = 0.1;
double farDistance = 100;
glu.gluPerspective(angle, aspect, nearDistance, farDistance); // fovy, aspect, zNear, zFar
frustrum.setCamInternals(angle, aspect, nearDistance, 1);
frustrum.setCamDef(new Vector3(0, 1, 0.6f), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
示例13: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL 2 graphics context
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
gl.glLoadIdentity(); // reset the model-view matrix
gl.glTranslatef(0.0f, 0.0f, -6.0f); // translate into the screen
gl.glColor3f(1, 1, 1); //set the triangle color
gl.glScaled(5, 5, 5);
bunny.draw(g);
}
示例14: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init( GLAutoDrawable drawable ) {
// drawable.setGL(new DebugGL(drawable.getGL()));
drawable.setAutoSwapBufferMode(true);
final GL2 gl = drawable.getGL().getGL2();
// log.info("OpenGL implementation is: " + gl.getClass().getName() + "\nGL_VENDOR: "
// + gl.glGetString(GL.GL_VENDOR) + "\nGL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\nGL_VERSION: "
// + gl.glGetString(GL.GL_VERSION) // + "\nGL_EXTENSIONS: " + gl.glGetString(GL.GL_EXTENSIONS)
// );
final float glVersion = Float.parseFloat(gl.glGetString(GL.GL_VERSION).substring(0, 3));
if (glVersion < 1.3f) {
// log.warning("\n\n*******************\nOpenGL version "
// + glVersion
// + " < 1.3, some features may not work and program may crash\nTry switching from 16 to 32 bit color if you have decent graphics card\n\n");
}
// System.out.println("GLU_EXTENSIONS: "+glu.gluGetString(GLU.GLU_EXTENSIONS));
gl.setSwapInterval(1);
gl.glShadeModel(GLLightingFunc.GL_FLAT);
gl.glClearColor(0, 0, 0, 0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
gl.glRasterPos3f(0, 0, 0);
gl.glColor3f(1, 1, 1);
// glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "Initialized display");
// Start animator (which should be a field).
animator = new FPSAnimator(glcanvas, 60);
animator.start();
}
示例15: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL 2 graphics context
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
gl.glLoadIdentity(); // reset the model-view matrix
gl.glTranslatef(0.0f, 0.0f, -6.0f); // translate into the screen
gl.glColor3f(1, 1, 1); //set the triangle color
gl.glBegin(GL.GL_TRIANGLES); // draw using triangles
gl.glVertex3f(0.0f, 1.0f, 0.0f);
gl.glVertex3f(-1.0f, -1.0f, 0.0f);
gl.glVertex3f(1.0f, -1.0f, 0.0f);
gl.glEnd();
}