Example usage for org.lwjgl.opengl GL11 glViewport

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

Introduction

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

Prototype

public static void glViewport(@NativeType("GLint") int x, @NativeType("GLint") int y,
        @NativeType("GLsizei") int w, @NativeType("GLsizei") int h) 

Source Link

Document

Specifies the viewport transformation parameters for all viewports.

Usage

From source file:org.terasology.rendering.opengl.LwjglFrameBufferObject.java

License:Apache License

@Override
public void bindFrame() {
    vp = BufferUtils.createIntBuffer(16);
    GL11.glGetInteger(GL11.GL_VIEWPORT, vp);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frame);
    GL11.glViewport(0, 0, size.x, size.y);

    glMatrixMode(GL_TEXTURE);/*w ww.  jav a2s. c o  m*/
    glLoadIdentity();
    glTranslatef(0.5f, 0.5f, 0.0f);
    glScalef(1, -1, 1);
    glTranslatef(-0.5f, -0.5f, 0.0f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, size.x, size.y, 0, 0, 2048f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

From source file:org.voxels.platform.LWJGLOpenGLAdapter.java

License:Open Source License

@Override
public void glViewport(final int x, final int y, final int width, final int height) {
    GL11.glViewport(x, y, width, height);
}

From source file:org.xmlvm.iphone.gl.GL.java

License:Open Source License

public static void glViewport(int i, int j, int backingWidth, int backingHeight) {
    GL11.glViewport(i, j, backingWidth, backingHeight);
}

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glViewport(int x, int y, int width, int height) {
    GL11.glViewport(x, y, width, height);
}

From source file:processing.lwjgl.PLWJGL.java

License:Open Source License

public void viewport(int x, int y, int w, int h) {
    GL11.glViewport(x, y, w, h);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void viewport(int x, int y, int w, int h) {
    float f = Display.getPixelScaleFactor();
    GL11.glViewport((int) (f * x), (int) (f * y), (int) f * w, (int) (f * h));
}

From source file:rainet.Game.java

private void initGL(int width, int height, String title) {
    try {//from  w  w  w .  j  a v  a  2s  .c  o  m
        Display.setDisplayMode(new DisplayMode(width, height));
        Display.setLocation(6, 7);
        Display.setTitle(title);
        Display.create();
        Display.setVSyncEnabled(true);
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glViewport(0, 0, width, height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, height, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

From source file:render.Render.java

License:Open Source License

public void resetGL() {
    try {//from www .j a  v  a 2  s . c o m
        Display.setDisplayMode(
                new DisplayMode(Display.getParent().getWidth(), Display.getParent().getHeight()));
    } catch (LWJGLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(-Display.getWidth() / 2, Display.getWidth() / 2, -Display.getHeight() / 2,
            Display.getHeight() / 2, -1.0, 1.0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

}

From source file:ru.axialshift.display.Processor.java

License:Apache License

private void preconfigureOGL() {
    GL11.glClearColor(0.4f, 0.6f, 0.9f, 0f);
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
}

From source file:se.angergard.engine.graphics.FrameBuffer.java

License:Apache License

public void begin() {
    GL11.glViewport(0, 0, width, height);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    RenderUtil.clearScreen();
}