Example usage for org.lwjgl.opengl GL11 glMatrixMode

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

Introduction

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

Prototype

public static native void glMatrixMode(@NativeType("GLenum") int mode);

Source Link

Document

Set the current matrix mode.

Usage

From source file:org.jogamp.glg2d.impl.gl2.GL2StringDrawer.java

License:Apache License

protected void begin(TrueTypeFont renderer) {
    setTextColorRespectComposite(renderer);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();/*from   w w w . j  a  v  a 2s. c  o  m*/
    GL11.glScalef(1, -1, 1);
    GL11.glTranslatef(0, -g2d.getCanvasHeight(), 0);

}

From source file:org.jogamp.glg2d.impl.gl2.GL2Transformhelper.java

License:Apache License

protected void setupGLView() {
    IntBuffer viewportDimensions = BufferUtils.createIntBuffer(16);
    GL11.glGetInteger(GL11.GL_VIEWPORT, viewportDimensions);
    int width = viewportDimensions.get(2);
    int height = viewportDimensions.get(3);

    // setup projection
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//www . j  av a  2 s .c  om
    GL11.glOrtho(0, width, 0, height, -1, 1);

    // the MODELVIEW matrix will get adjusted later

    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glLoadIdentity();
}

From source file:org.jogamp.glg2d.impl.gl2.GL2Transformhelper.java

License:Apache License

/**
 * Sends the {@code AffineTransform} that's on top of the stack to the video
 * card./*from   w w  w . j a  v  a2  s . co  m*/
 */
protected void flushTransformToOpenGL() {
    FloatBuffer matrix = getGLMatrix(stack.peek());

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadMatrix(matrix);
}

From source file:org.jogamp.glg2d.impl.gl2.LineDrawingVisitor.java

License:Apache License

@Override
public void beginPoly(int windingRule) {
    /*/*from  w ww .j  a  v  a2  s  .  c o  m*/
     * pen hangs down and to the right. See java.awt.Graphics
     */
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.5f, 0.5f, 0);

    super.beginPoly(windingRule);
}

From source file:org.jogamp.glg2d.impl.gl2.LineDrawingVisitor.java

License:Apache License

@Override
public void endPoly() {
    super.endPoly();

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

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

License:Open Source License

@Override
public void initView() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//from w w  w .  j  a  v a 2  s .  c om
    GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 40.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.TruckViewerConfiguration.java

License:Open Source License

@Override
public void initView() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//  w  w  w . j av  a2  s. c  om
    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();//from   w  w w  .  j ava2 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}// w w  w .ja  v  a  2 s  .  c o 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
 * /*ww w .ja  v  a  2  s .  c o  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;
}