Java 类org.lwjgl.opengl.Pbuffer 实例源码

项目:trashjam2017    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:trashjam2017    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:trashjam2017    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:trashjam2017    文件:GraphicsFactory.java   
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
    init = true;

    if (fbo) {
        fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
    }
    pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
    pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;

    if (!fbo && !pbuffer && !pbufferRT) {
        throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
    }

    Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
项目:trashjam2017    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        image.draw(0,0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                              tex.getTextureWidth(), 
                              tex.getTextureHeight(), 0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:Progetto-C    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:Progetto-C    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:Progetto-C    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:Progetto-C    文件:GraphicsFactory.java   
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
    init = true;

    if (fbo) {
        fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
    }
    pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
    pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;

    if (!fbo && !pbuffer && !pbufferRT) {
        throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
    }

    Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
项目:Progetto-C    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        image.draw(0,0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                              tex.getTextureWidth(), 
                              tex.getTextureHeight(), 0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:BaseClient    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:BaseClient    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:BaseClient    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:BaseClient    文件:GraphicsFactory.java   
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
    init = true;

    if (fbo) {
        fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
    }
    pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
    pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;

    if (!fbo && !pbuffer && !pbufferRT) {
        throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
    }

    Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
项目:BaseClient    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        image.draw(0,0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                              tex.getTextureWidth(), 
                              tex.getTextureHeight(), 0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:PhET    文件:StartupUtils.java   
/**
 * @return Maxiumum anti-aliasing samples supported. Required to have the LWJGL libraries loaded before calling
 */
public static int getMaximumAntialiasingSamples() {
    int result = 0;
    try {
        Pbuffer pb = new Pbuffer( 10, 10, new PixelFormat( 24, 8, 24, 8, 0 ), null );
        pb.makeCurrent();
        boolean supported = GLContext.getCapabilities().GL_ARB_multisample;
        if ( supported ) {
            result = GL11.glGetInteger( GL30.GL_MAX_SAMPLES );
        }
        pb.destroy();
    }
    catch( LWJGLException e ) {
        //e.printStackTrace();
    }
    return result;
}
项目:PhET    文件:JMEUtils.java   
/**
 * @return Maxiumum anti-aliasing samples supported. Required to have the LWJGL libraries loaded before calling
 */
public static int getMaximumAntialiasingSamples() {
    int result = 0;
    try {
        Pbuffer pb = new Pbuffer( 10, 10, new PixelFormat( 32, 0, 24, 8, 0 ), null );
        pb.makeCurrent();
        boolean supported = GLContext.getCapabilities().GL_ARB_multisample;
        if ( supported ) {
            result = GL11.glGetInteger( GL30.GL_MAX_SAMPLES );
        }
        pb.destroy();
    }
    catch ( LWJGLException e ) {
        //e.printStackTrace();
    }
    return result;
}
项目:code404    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:code404    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:code404    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:code404    文件:GraphicsFactory.java   
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
    init = true;

    if (fbo) {
        fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
    }
    pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
    pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;

    if (!fbo && !pbuffer && !pbufferRT) {
        throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
    }

    Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
项目:code404    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        image.draw(0,0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                              tex.getTextureWidth(), 
                              tex.getTextureHeight(), 0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:Resilience-Client-Source    文件:WrUpdaterThreaded.java   
public WrUpdateThread createUpdateThread(Drawable displayDrawable)
{
    if (this.updateThread != null)
    {
        throw new IllegalStateException("UpdateThread is already existing");
    }
    else
    {
        try
        {
            Pbuffer e = new Pbuffer(1, 1, new PixelFormat(), displayDrawable);
            this.updateThread = new WrUpdateThread(e);
            this.updateThread.setPriority(1);
            this.updateThread.start();
            this.updateThread.pause();
            return this.updateThread;
        }
        catch (Exception var3)
        {
            throw new RuntimeException(var3);
        }
    }
}
项目:tribaltrouble    文件:PbufferRenderer.java   
PbufferRenderer(int width, int height, PixelFormat format, boolean use_copyteximage, OffscreenRendererFactory factory) throws LWJGLException {
    super(width, height, use_copyteximage);
    this.factory = factory;
    pbuffer = new Pbuffer(width, height, format, null, null);
    GLStateStack state_stack = new GLStateStack();
    pbuffer.makeCurrent();
    GLStateStack.setCurrent(state_stack);
    try {
        pbuffer.makeCurrent();
        Renderer.dumpWindowInfo();
        init();
        if (!GLUtils.getGLBoolean(GL11.GL_DOUBLEBUFFER)) {
            GL11.glReadBuffer(GL11.GL_FRONT);
            GL11.glDrawBuffer(GL11.GL_FRONT);
        }
    } catch (LWJGLException e) {
        pbuffer.destroy();
        throw e;
    }
}
项目:fuzzy-octo-shame    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 *
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);

        if (image.getTexture()!=null)
            image.draw(0,0);
        Graphics.setCurrent(this); //this means you need to call flush() after getGraphics()
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:fuzzy-octo-shame    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:fuzzy-octo-shame    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:fuzzy-octo-shame    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 *
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        if (image.getTexture()!=null) {
            image.draw(0,0);
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
            GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0,
                                  tex.getTextureWidth(),
                                  tex.getTextureHeight(), 0);
        }
        Graphics.setCurrent(this); //this means you need to call flush() after getGraphics
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:GPVM    文件:GraphicsFactory.java   
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
    init = true;

    if (fbo) {
        fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
    }
    pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
    pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;

    if (!fbo && !pbuffer && !pbufferRT) {
        throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
    }

    Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
项目:GPVM    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        image.draw(0,0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                              tex.getTextureWidth(), 
                              tex.getTextureHeight(), 0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#enable()
 */
protected void enable() {
    SlickCallable.enterSafeBlock();

    try {
        if (pbuffer.isBufferLost()) {
            pbuffer.destroy();
            init();
        }

        pbuffer.makeCurrent();
    } catch (Exception e) {
        Log.error("Failed to recreate the PBuffer");
        throw new RuntimeException(e);
    }

    // Put the renderer contents to the texture
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
    TextureImpl.unbind();
    initGL();
}
项目:GPVM    文件:GraphicsFactory.java   
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
    init = true;

    if (fbo) {
        fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
    }
    pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
    pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;

    if (!fbo && !pbuffer && !pbufferRT) {
        throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
    }

    Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
项目:GPVM    文件:PBufferUniqueGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        image.draw(0,0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                              tex.getTextureWidth(), 
                              tex.getTextureHeight(), 0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:SpaceStationAlpha    文件:PBufferGraphics.java   
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
    try {
        Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

        final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
        pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

        // Initialise state of the pbuffer context.
        pbuffer.makeCurrent();

        initGL();
        GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
        pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
        image.draw(0,0);
        image.setTexture(tex);

        Display.makeCurrent();
    } catch (Exception e) {
        Log.error(e);
        throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
    }
}
项目:SpaceStationAlpha    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}