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


Java Pbuffer类代码示例

本文整理汇总了Java中org.lwjgl.opengl.Pbuffer的典型用法代码示例。如果您正苦于以下问题:Java Pbuffer类的具体用法?Java Pbuffer怎么用?Java Pbuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * 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,代码行数:28,代码来源:PBufferGraphics.java

示例2: disable

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * @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();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:PBufferGraphics.java

示例3: enable

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * @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();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:25,代码来源:PBufferGraphics.java

示例4: init

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:22,代码来源:GraphicsFactory.java

示例5: init

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * 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?");
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:PBufferUniqueGraphics.java

示例6: getMaximumAntialiasingSamples

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * @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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:StartupUtils.java

示例7: getMaximumAntialiasingSamples

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * @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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:JMEUtils.java

示例8: createUpdateThread

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:24,代码来源:WrUpdaterThreaded.java

示例9: PbufferRenderer

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
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;
	}
}
 
开发者ID:sunenielsen,项目名称:tribaltrouble,代码行数:21,代码来源:PbufferRenderer.java

示例10: init

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * 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,代码行数:31,代码来源:PBufferGraphics.java

示例11: disable

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * @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();
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:19,代码来源:PBufferGraphics.java

示例12: enable

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * @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();
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:25,代码来源:PBufferGraphics.java

示例13: init

import org.lwjgl.opengl.Pbuffer; //导入依赖的package包/类
/**
 * 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?");
    }
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:31,代码来源:PBufferUniqueGraphics.java


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