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:com.xrbpowered.gl.Client.java

License:Open Source License

public void switchToBorderless(boolean resizeResources) throws LWJGLException {
    DisplayMode desktop = Display.getDesktopDisplayMode();
    System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
    Display.setFullscreen(false);/*from  w  ww.ja  v a2  s. com*/
    Display.setDisplayMode(new DisplayMode(desktop.getWidth(), desktop.getHeight()));
    Display.setResizable(false);
    if (resizeResources) {
        GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
        createRenderTarget();
        resizeResources();
    }
}

From source file:com.xrbpowered.gl.Client.java

License:Open Source License

public DisplayMode switchToFullscreen(int width, int height, int freq, boolean resizeResources)
        throws LWJGLException {
    DisplayMode mode = findFullscreenMode(width, height, freq);
    Display.setDisplayModeAndFullscreen(mode);
    if (resizeResources) {
        GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
        createRenderTarget();/*from w  ww .jav a  2  s .c  o  m*/
        resizeResources();
    }
    return mode;
}

From source file:com.xrbpowered.gl.res.buffers.RenderTarget.java

License:Open Source License

public void use() {
    GL11.glViewport(0, 0, getWidth(), getHeight());
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo);
}

From source file:cuchaz.jfxgl.glass.JFXGLWindow.java

License:Open Source License

@CalledByMainThread
@InAppGLContext//from  w ww  . ja  va  2  s.c  o m
public void renderFramebuf() {
    if (buf != null) {

        glstate.backup();

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glViewport(0, 0, width, height);

        // composite our framebuffer onto the main framebuffer
        buf.render();

        glstate.restore();
    }
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

@Override
public void updateViewportAndDepthTest(int x, int y, int w, int h, boolean depthTest) {

    GL11.glViewport(x, y, w, h);

    if (depthTest) {
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glDepthMask(true);//w  w w  . j a v  a  2  s  .c  om
    } else {
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
    }
}

From source file:de.codesourcery.flocking.LWJGLRenderer.java

License:Apache License

private void initGL() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//from   ww w  .java 2s.  c o  m
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
    GL11.glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 1, -1);
    //        GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLRenderer2Stage.java

License:Open Source License

public GLRenderer2Stage(GLScene scene, GLResources resourceManager, GLCamera camera, int width, int height) {
    this.scene = scene;
    this.camera = camera;
    this.width = width;
    this.height = height;

    // setup opengl
    GL11.glViewport(0, 0, width, height);

    // setup framebuffer
    fbAId = GL30.glGenFramebuffers();//from w  w  w  . ja  va  2  s  .  c o  m
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbAId);

    // color buffer
    fbATexId = GLTextureBuilder.createEmptyTexture("FB", width, height, (byte) 0, (byte) 0, (byte) 0, (byte) 0)
            .getTextureId();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, fbATexId,
            0);

    // create depth buffer
    dbATexId = GLTextureBuilder.createEmptyTexture("DB", width, height, 0.0f).getTextureId();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, dbATexId, 0);

    int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);

    if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
        ML.f(String.format("Cannot set up framebuffer: %x", status));
    }

    // setup framebuffer B
    fbBId = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbBId);

    // color buffer
    fbBTexId = GLTextureBuilder.createEmptyTexture("FB", width, height, (byte) 0, (byte) 0, (byte) 0, (byte) 0)
            .getTextureId();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, fbBTexId,
            0);

    status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);

    if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
        ML.f(String.format("Cannot set up framebuffer: %x", status));
    }

    ssqScene = new GLSSQScene(resourceManager, resourceManager.getShader("post"), new GLTexture("FB", fbATexId),
            new GLTexture("DB", dbATexId), resourceManager.getShader("post2"), new GLTexture("FB2", fbBTexId));
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLRendererForward.java

License:Open Source License

public GLRendererForward(GLScene scene, GLResources resourceManager, GLCamera camera, int width, int height) {
    this.scene = scene;
    this.camera = camera;
    this.width = width;
    this.height = height;

    // setup opengl
    GL11.glViewport(0, 0, width, height);
}

From source file:dripdisplay.DripDisplayLWJGL.java

protected void initGLLWJGL() {

    if (!LEVEL_EDITOR) {
        GL11.glViewport(0, 0, 800, 600);
    } else {//from  w w w. java2s.c o m
        GL11.glViewport(0, 0, 1000, 800);
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    if (!LEVEL_EDITOR) {
        GL11.glOrtho(0, 800, 600, 0, 1, -1);
    } else {
        GL11.glOrtho(0, 1000, 800, 0, 1, -1);
    }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    initTextures();
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    createModel();
}

From source file:dripdisplay.DripDisplayLWJGL.java

protected void resetGL() {
    GL11.glViewport(0, 0, 800, 600);
}