本文整理匯總了Java中org.lwjgl.opengl.Display.makeCurrent方法的典型用法代碼示例。如果您正苦於以下問題:Java Display.makeCurrent方法的具體用法?Java Display.makeCurrent怎麽用?Java Display.makeCurrent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.opengl.Display
的用法示例。
在下文中一共展示了Display.makeCurrent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.lwjgl.opengl.Display; //導入方法依賴的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.Display; //導入方法依賴的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: init
import org.lwjgl.opengl.Display; //導入方法依賴的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?");
}
}
示例4: disable
import org.lwjgl.opengl.Display; //導入方法依賴的package包/類
/**
* @see org.newdawn.slick.Graphics#disable()
*/
protected void disable() {
// Bind the texture after rendering.
GL11.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0,
image.getTexture().getTextureWidth(),
image.getTexture().getTextureHeight(), 0);
try {
Display.makeCurrent();
} catch (LWJGLException e) {
Log.error(e);
}
SlickCallable.leaveSafeBlock();
}