Example usage for org.eclipse.swt.opengl GL glLoadIdentity

List of usage examples for org.eclipse.swt.opengl GL glLoadIdentity

Introduction

In this page you can find the example usage for org.eclipse.swt.opengl GL glLoadIdentity.

Prototype

public static native void glLoadIdentity();

Source Link

Usage

From source file:org.eclipse.swt.snippets.Snippet174.java

static void render() {
    GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    GL.glLoadIdentity();
    GL.glTranslatef(0.0f, 0.0f, -6.0f);//  www . ja v a 2s.c om
    GL.glBegin(GL.GL_QUADS);
    GL.glVertex3f(-1.0f, 1.0f, 0.0f);
    GL.glVertex3f(1.0f, 1.0f, 0.0f);
    GL.glVertex3f(1.0f, -1.0f, 0.0f);
    GL.glVertex3f(-1.0f, -1.0f, 0.0f);
    GL.glEnd();
}

From source file:org.eclipse.swt.snippets.Snippet174.java

static void resize(GLCanvas canvas) {
    canvas.setCurrent();/*from  ww w .  ja v  a  2  s.co m*/
    Rectangle rect = canvas.getClientArea();
    int width = rect.width;
    int height = Math.max(rect.height, 1);
    GL.glViewport(0, 0, width, height);
    GL.glMatrixMode(GL.GL_PROJECTION);
    GL.glLoadIdentity();
    float aspect = (float) width / (float) height;
    GLU.gluPerspective(45.0f, aspect, 0.5f, 400.0f);
    GL.glMatrixMode(GL.GL_MODELVIEW);
    GL.glLoadIdentity();
}

From source file:org.eclipse.swt.snippets.Snippet174.java

static void resize(Canvas canvas) {
    Rectangle rect = canvas.getClientArea();
    int width = rect.width;
    int height = Math.max(rect.height, 1);
    GL.glViewport(0, 0, width, height);/*from  w  ww  .  ja v a2 s  .  c  o m*/
    GL.glMatrixMode(GL.GL_PROJECTION);
    GL.glLoadIdentity();
    float aspect = (float) width / (float) height;
    GLU.gluPerspective(45.0f, aspect, 0.5f, 400.0f);
    GL.glMatrixMode(GL.GL_MODELVIEW);
    GL.glLoadIdentity();
}