当前位置: 首页>>代码示例>>Java>>正文


Java RenderTexture.RENDER_TEXTURE_2D属性代码示例

本文整理汇总了Java中org.lwjgl.opengl.RenderTexture.RENDER_TEXTURE_2D属性的典型用法代码示例。如果您正苦于以下问题:Java RenderTexture.RENDER_TEXTURE_2D属性的具体用法?Java RenderTexture.RENDER_TEXTURE_2D怎么用?Java RenderTexture.RENDER_TEXTURE_2D使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.lwjgl.opengl.RenderTexture的用法示例。


在下文中一共展示了RenderTexture.RENDER_TEXTURE_2D属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

/**
 * 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?");
    }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:27,代码来源:PBufferGraphics.java

示例2: init

/**
 * 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?");
    }
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:30,代码来源:PBufferGraphics.java


注:本文中的org.lwjgl.opengl.RenderTexture.RENDER_TEXTURE_2D属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。