本文整理汇总了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?");
}
}
示例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();
}
示例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();
}
示例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);
}
示例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?");
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
示例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?");
}
}
示例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();
}
示例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();
}
示例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?");
}
}