Example usage for org.lwjgl.opengl GL11 GL_MODELVIEW

List of usage examples for org.lwjgl.opengl GL11 GL_MODELVIEW

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 GL_MODELVIEW.

Prototype

int GL_MODELVIEW

To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.

Click Source Link

Document

MatrixMode

Usage

From source file:org.jtrfp.mtmx.tools.internal.TruckViewerConfiguration.java

License:Open Source License

@Override
public void initView() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//from w ww  . java 2 s  .c  o  m
    GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 25.0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    //GL11.glClearDepth(0.5f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:org.jtrfp.mtmx.tools.internal.WorldViewerConfiguration.java

License:Open Source License

@Override
public void initView() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//w  w  w.  ja va 2  s .  c  o  m
    GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0f, 150 * IDrawer.WORLD_SCALE_XZ);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:org.lwjgl.info.LWJGLTestView.java

License:Open Source License

/** 
 * {@inheritDoc}//from w w  w .j  av a  2s  .  co m
 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
@Override
public void createPartControl(Composite parent) {

    String strVersion = getFeatureVersion("org.lwjgl");
    this.setPartName("org.lwjgl " + strVersion);

    IStatusLineManager statusLine = this.getViewSite().getActionBars().getStatusLineManager();

    fpsstatuslineitem = new FpsStatusLineItem();
    statusLine.add(fpsstatuslineitem);

    GLData data = new GLData();
    data.doubleBuffer = true;
    canvas = new GLCanvas(parent, SWT.NONE, data);

    canvas.setCurrent();
    try {
        GLContext.useContext(canvas);
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    canvas.addListener(SWT.Resize, new Listener() {
        public void handleEvent(Event event) {
            Rectangle bounds = canvas.getBounds();
            float fAspect = (float) bounds.width / (float) bounds.height;
            canvas.setCurrent();
            try {
                GLContext.useContext(canvas);
            } catch (LWJGLException e) {
                e.printStackTrace();
            }
            GL11.glViewport(0, 0, bounds.width, bounds.height);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
        }
    });

    GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glClearDepth(1.0);
    GL11.glLineWidth(2);
    GL11.glEnable(GL11.GL_DEPTH_TEST);

    Display.getCurrent().asyncExec(initRunnable());

}

From source file:org.meanworks.engine.camera.Camera.java

License:Open Source License

/**
 * Setup the camera to look at something
 * //  www  . ja  v  a2  s  .  co m
 * @param eye
 * @param target
 * @return
 */
public Matrix4f lookAt(Vector3f eye, Vector3f target) {
    Matrix4f persp = new Matrix4f();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    {
        GL11.glPushMatrix();
        {
            GL11.glLoadIdentity();
            GLU.gluLookAt(eye.x, eye.y, eye.z, target.x, target.y, target.z, upVector.x, upVector.y,
                    upVector.z);
            MatrixHelper.getMatrix(GL11.GL_MODELVIEW_MATRIX, persp);
        }
        GL11.glPopMatrix();
    }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    return persp;
}

From source file:org.meanworks.engine.camera.Camera.java

License:Open Source License

/**
 * Temporary function for setting up the projection matrix
 *//*from  w w w  . ja  v  a2s.  c o m*/
private Matrix4f perspective(float fovY, float aspect, float nearPlane, float farPlane, Matrix4f storeIn) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    {
        GL11.glPushMatrix();
        {
            GL11.glLoadIdentity();
            GLU.gluPerspective(fovY, aspect, nearPlane, farPlane);
            MatrixHelper.getMatrix(GL11.GL_PROJECTION_MATRIX, storeIn);
        }
        GL11.glPopMatrix();
    }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    return storeIn;
}

From source file:org.meanworks.engine.camera.Camera.java

License:Open Source License

/**
 * /*from  ww w.j ava  2s. c  o m*/
 */
public void immediateCameraSetup() {
    // Setup camera
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glRotatef(rotation.x, 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(rotation.y, 0.0f, 1.0f, 0.0f);
    GL11.glTranslatef(-cameraPosition.x, -cameraPosition.y, -cameraPosition.z);
}

From source file:org.mkdev.ai.langton3d.core.App.java

License:GNU General Public License

private boolean initGL() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();/*w w w  .j a v a2  s.  c  o  m*/

    GLU.gluPerspective(FOV, ((float) targetWidth) / ((float) targetHeight), 0.1f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_FASTEST);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

    setupLights();
    setupFog(Settings.FOG_DENSITY, Settings.FOG_START, Settings.FOG_END);

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    return true;
}

From source file:org.mkdev.ai.langton3d.core.App.java

License:GNU General Public License

private void render() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();/*from   ww  w .  j ava  2s  .  c o  m*/

    drawBackground();

    GL11.glPushMatrix();

    Camera.applyRotation();

    drawWireframeCube();

    GL11.glTranslatef(-1.5f, -1.5f, -1.5f);

    drawSceneCubes();

    GL11.glPopMatrix();

    dt = getDeltaTime();
}

From source file:org.mkdev.ai.langton3d.core.App.java

License:GNU General Public License

private void drawBackground() {
    GL11.glDisable(GL11.GL_DEPTH_TEST);//  w w  w .j a v a2 s .c  o  m
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    GL11.glClearColor(Settings.BKG_COLOR_RED, Settings.BKG_COLOR_GREEN, Settings.BKG_COLOR_BLUE,
            Settings.BKG_COLOR_ALPHA);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glDisable(GL_LIGHTING);

    GL11.glBegin(GL11.GL_QUADS);

    GL11.glColor4f(Settings.BKG_COLOR_RED, Settings.BKG_COLOR_GREEN, Settings.BKG_COLOR_BLUE,
            Settings.BKG_COLOR_ALPHA);
    GL11.glVertex2f(-1.0f, -1.0f);
    GL11.glVertex2f(1.0f, -1.0f);

    GL11.glColor4f(Settings.BKG_COLOR_RED / 2, Settings.BKG_COLOR_GREEN / 2, Settings.BKG_COLOR_BLUE / 2,
            Settings.BKG_COLOR_ALPHA);
    GL11.glVertex2f(1.0f, 1.0f);
    GL11.glVertex2f(-1.0f, 1.0f);

    GL11.glEnd();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

private void setCamera(float x, float y, float z, float rx, float ry, float rz) {
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();// www  .j  a va2 s  . c  om
    //      GL11.glRotatef (90, 0,0,1);
    //      GL11.glRotatef (90, 0,1,0);
    GL11.glRotatef(rx, 1, 0, 0);
    GL11.glRotatef(ry, 0, 1, 0);
    GL11.glRotatef(rz, 0, 0, 1);
    GL11.glTranslatef(-x, -y, -z);
}