本文整理汇总了Java中org.lwjgl.opengl.Pbuffer.getCapabilities方法的典型用法代码示例。如果您正苦于以下问题:Java Pbuffer.getCapabilities方法的具体用法?Java Pbuffer.getCapabilities怎么用?Java Pbuffer.getCapabilities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.Pbuffer
的用法示例。
在下文中一共展示了Pbuffer.getCapabilities方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: PBufferGraphics
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
/**
* Create a new graphics context around a pbuffer
*
* @param image The image we're rendering to
* @throws SlickException Indicates a failure to use pbuffers
*/
public PBufferGraphics(Image image) throws SlickException {
super(image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight());
this.image = image;
Log.debug("Creating pbuffer(rtt) "+image.getWidth()+"x"+image.getHeight());
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
throw new SlickException("Your OpenGL card does not support PBuffers and hence can't handle the dynamic images required for this application.");
}
if ((Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) == 0) {
throw new SlickException("Your OpenGL card does not support Render-To-Texture and hence can't handle the dynamic images required for this application.");
}
init();
}
示例3: PBufferUniqueGraphics
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
/**
* Create a new graphics context around a pbuffer
*
* @param image The image we're rendering to
* @throws SlickException Indicates a failure to use pbuffers
*/
public PBufferUniqueGraphics(Image image) throws SlickException {
super(image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight());
this.image = image;
Log.debug("Creating pbuffer(unique) "+image.getWidth()+"x"+image.getHeight());
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
throw new SlickException("Your OpenGL card does not support PBuffers and hence can't handle the dynamic images required for this application.");
}
init();
}
示例4: PbufferTest
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
public PbufferTest(final int renderMode) {
try {
//find displaymode
mode = findDisplayMode(800, 600, 16);
Display.setDisplayMode(mode);
Display.create(new PixelFormat(16, 0, 0, 0, 0));
glInit();
if ( (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0 ) {
System.out.println("No Pbuffer support!");
System.exit(-1);
}
System.out.println("Pbuffer support detected. Initializing...\n");
switch ( renderMode ) {
case 1:
System.out.print("Creating pbuffer with unique context...");
texRenderer = new UniqueRenderer(TEXTURE_SIZE, TEXTURE_SIZE, texID);
break;
case 2:
System.out.print("Creating render-to-texture pbuffer with unique context...");
texRenderer = new UniqueRendererRTT(TEXTURE_SIZE, TEXTURE_SIZE, texID);
break;
}
System.out.println("OK");
quadPosition = new Vector2f(100f, 100f);
quadVelocity = new Vector2f(1.0f, 1.0f);
texScaleX = TEXTURE_SIZE / (float)mode.getWidth();
texScaleY = TEXTURE_SIZE / (float)mode.getHeight();
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: initialize
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
/**
* Initializes the test
*/
private void initialize() {
try {
//find displaymode
pbuffer = new Pbuffer(512, 512, new PixelFormat(), null, null);
mode = findDisplayMode(800, 600, 16);
Display.setDisplayMode(mode);
// start of in windowed mode
Display.create();
// gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
System.out.println("No Pbuffer support!");
System.exit(1);
}
System.out.println("Pbuffer support detected");
glInit();
initPbuffer();
Keyboard.create();
quadPosition = new Vector2f(100f, 100f);
quadVelocity = new Vector2f(1.0f, 1.0f);
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: PBufferGraphics
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
/**
* Create a new graphics context around a pbuffer
*
* @param image The image we're rendering to
* @throws SlickException Indicates a failure to use pbuffers
*/
public PBufferGraphics(@Nonnull Image image) throws SlickException {
super(InternalTextureLoader.get2Fold(image.getWidth()), InternalTextureLoader.get2Fold(image.getHeight()));
this.image = image;
Log.debug("Creating pbuffer(rtt) "+image.getWidth()+"x"+image.getHeight());
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
throw new SlickException("Your OpenGL card does not support PBuffers and hence can't handle the dynamic images required for this application.");
}
if ((Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) == 0) {
throw new SlickException("Your OpenGL card does not support Render-To-Texture and hence can't handle the dynamic images required for this application.");
}
init();
}
示例7: 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 {
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);
}
示例8: PBufferUniqueGraphics
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
/**
* Create a new graphics context around a pbuffer
*
* @param image The image we're rendering to
* @throws SlickException Indicates a failure to use pbuffers
*/
public PBufferUniqueGraphics(@Nonnull Image image) throws SlickException {
super(InternalTextureLoader.get2Fold(image.getWidth()), InternalTextureLoader.get2Fold(image.getHeight()));
this.image = image;
Log.debug("Creating pbuffer(unique) "+image.getWidth()+"x"+image.getHeight());
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
throw new SlickException("Your OpenGL card does not support PBuffers and hence can't handle the dynamic images required for this application.");
}
init();
}
示例9: initInThread
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
protected void initInThread(){
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0){
logger.severe("Offscreen surfaces are not supported.");
return;
}
pixelFormat = new PixelFormat(settings.getBitsPerPixel(),
0,
settings.getDepthBits(),
settings.getStencilBits(),
settings.getSamples());
width = settings.getWidth();
height = settings.getHeight();
try{
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable thrown) {
listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
}
});
pbuffer = new Pbuffer(width, height, pixelFormat, null, null, createContextAttribs());
pbuffer.makeCurrent();
renderable.set(true);
logger.info("Offscreen buffer created.");
printContextInitInfo();
} catch (LWJGLException ex){
listener.handleError("Failed to create display", ex);
} finally {
// TODO: It is possible to avoid "Failed to find pixel format"
// error here by creating a default display.
}
super.internalCreate();
listener.initialize();
}
示例10: initInThread
import org.lwjgl.opengl.Pbuffer; //导入方法依赖的package包/类
protected void initInThread(){
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0){
logger.severe("Offscreen surfaces are not supported.");
return;
}
pixelFormat = new PixelFormat(settings.getBitsPerPixel(),
0,
settings.getDepthBits(),
settings.getStencilBits(),
settings.getSamples());
width = settings.getWidth();
height = settings.getHeight();
try{
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable thrown) {
listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
}
});
//String rendererStr = settings.getString("Renderer");
// if (rendererStr.startsWith("LWJGL-OpenGL3")){
// ContextAttribs attribs;
// if (rendererStr.equals("LWJGL-OpenGL3.1")){
// attribs = new ContextAttribs(3, 1);
// }else{
// attribs = new ContextAttribs(3, 0);
// }
// attribs.withForwardCompatible(true);
// attribs.withDebug(false);
// Display.create(pf, attribs);
// }else{
pbuffer = new Pbuffer(width, height, pixelFormat, null, null, createContextAttribs());
// }
pbuffer.makeCurrent();
renderable.set(true);
logger.info("Offscreen buffer created.");
printContextInitInfo();
} catch (LWJGLException ex){
listener.handleError("Failed to create display", ex);
} finally {
// TODO: It is possible to avoid "Failed to find pixel format"
// error here by creating a default display.
}
super.internalCreate();
listener.initialize();
}