本文整理匯總了Java中org.lwjgl.opengl.PixelFormat類的典型用法代碼示例。如果您正苦於以下問題:Java PixelFormat類的具體用法?Java PixelFormat怎麽用?Java PixelFormat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PixelFormat類屬於org.lwjgl.opengl包,在下文中一共展示了PixelFormat類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.lwjgl.opengl.PixelFormat; //導入依賴的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: init
import org.lwjgl.opengl.PixelFormat; //導入依賴的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?");
}
}
示例3: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3, 2)
.withForwardCompatible(true)
.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle("MRCEngine");
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
示例4: Window
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
protected Window(Context context, WindowBuilder settings) {
this.fpsCap = settings.getFpsCap();
try {
getSuitableFullScreenModes();
DisplayMode resolution = getStartResolution(settings);
Display.setInitialBackground(1, 1, 1);
this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
setResolution(resolution, settings.isFullScreen());
if (settings.hasIcon()) {
Display.setIcon(settings.getIcon());
}
Display.setVSyncEnabled(settings.isvSync());
Display.setTitle(settings.getTitle());
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例5: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
private void createDisplay() throws LWJGLException {
Display.setResizable(true);
Display.setTitle("Minecraft 1.8.8");
try {
Display.create((new PixelFormat()).withDepthBits(24));
} catch (LWJGLException lwjglexception) {
logger.error((String) "Couldn\'t set pixel format", (Throwable) lwjglexception);
try {
Thread.sleep(1000L);
} catch (InterruptedException var3) {
;
}
if (this.fullscreen) {
this.updateDisplayMode();
}
Display.create();
}
}
示例6: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public static void createDisplay() {
// OpenGL version used
ContextAttribs attribs = new ContextAttribs(3, 2)
.withForwardCompatible(true)
.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle(TITLE);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
}
示例7: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public static void createDisplay() {
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
ContextAttribs attribs = new ContextAttribs(3, 2).withProfileCore(true).withForwardCompatible(true);
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), attribs);
Display.setTitle(TITLE);
Display.setInitialBackground(1, 1, 1);
GL11.glEnable(GL13.GL_MULTISAMPLE);
} catch (LWJGLException e) {
e.printStackTrace();
System.err.println("Couldn't create display!");
System.exit(-1);
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
示例8: Window
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
protected Window(Context context, WindowBuilder settings) {
this.fpsCap = settings.getFpsCap();
try {
getSuitableFullScreenModes();
DisplayMode resolution = getStartResolution(settings);
Display.setInitialBackground(0f, 0f, 0f);
this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
setResolution(resolution, settings.isFullScreen());
if (settings.hasIcon()) {
Display.setIcon(settings.getIcon());
}
Display.setVSyncEnabled(settings.isvSync());
Display.setTitle(settings.getTitle());
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例9: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3, 3)
.withForwardCompatible(true)
.withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle("Our First Display!");
GL11.glEnable(GL13.GL_MULTISAMPLE);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, WIDTH, HEIGHT);
lastFrameTime = getCurrentTime();
}
示例10: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public static void createDisplay() throws LWJGLException
{
ImageIO.setUseCache(false); //Disable on-disc stream cache should speed up texture pack reloading.
PixelFormat format = new PixelFormat().withDepthBits(24);
if (!Boolean.parseBoolean(System.getProperty("forge.forceDisplayStencil", "false")))
{
//Creating the display with Stencil bits causes issues on some displays.
//According to ChickenBones, Mumfrey and Pig The only real use is in the FBO.
//So lets default to normal init to fix the issues yet add the bits to the FBO.
Display.create(format);
stencilBits = 0;
return;
}
try
{
//TODO: Figure out how to determine the max bits.
Display.create(format.withStencilBits(8));
stencilBits = 8;
}
catch(LWJGLException e)
{
Display.create(format);
stencilBits = 0;
}
}
示例11: getMaximumAntialiasingSamples
import org.lwjgl.opengl.PixelFormat; //導入依賴的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;
}
示例12: getMaximumAntialiasingSamples
import org.lwjgl.opengl.PixelFormat; //導入依賴的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;
}
示例13: createDisplay
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public static void createDisplay() throws LWJGLException
{
ImageIO.setUseCache(false); //Disable on-disc stream cache should speed up texture pack reloading.
PixelFormat format = new PixelFormat().withDepthBits(24);
if (!ForgeModContainer.enableStencilBits || Boolean.parseBoolean(System.getProperty("forge.forceNoStencil", "false")))
{
Display.create(format);
stencilBits = 0;
return;
}
try
{
//TODO: Figure out how to determine the max bits.
Display.create(format.withStencilBits(8));
stencilBits = 8;
}
catch(LWJGLException e)
{
Display.create(format);
stencilBits = 0;
}
}
示例14: init
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
public void init() throws Exception {
try {
System.setProperty("org.lwjgl.opengl.Display.noinput", "true");
PixelFormat pixFormat = new PixelFormat();
ContextAttribs contextAttribs = new ContextAttribs(3, 2)
.withForwardCompatible(true)
.withProfileCore(true);
Display.setResizable(true);
Display.setParent(glCanvas);
Display.create(pixFormat, contextAttribs);
// TODO: Find the reason why this hack is necessary and fix it
// Without this, the menu bar will be below the canvas and isMouseInsideWindow
// will return false unless it left and re-entered the frame once
SwingUtilities.invokeLater(() -> {
Component root = SwingUtilities.getRoot(glCanvas);
root.setSize(root.getWidth(), root.getHeight() + 1);
root.setSize(root.getWidth(), root.getHeight() - 1);
});
initGL();
} catch (LWJGLException e) {
log.log(Level.SEVERE, "Couldn't create display: " + e.getMessage(), e);
throw e;
}
lastFPSReport = game.getTimeMillis();
}
示例15: setupOpenGL
import org.lwjgl.opengl.PixelFormat; //導入依賴的package包/類
private void setupOpenGL() {
// Setup an OpenGL context with API version 3.2
try {
PixelFormat pixelFormat = new PixelFormat();
ContextAttribs contextAtrributes = new ContextAttribs(3, 2)
.withForwardCompatible(true)
.withProfileCore(true);
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.setTitle(WINDOW_TITLE);
Display.create(pixelFormat, contextAtrributes);
GL11.glViewport(0, 0, WIDTH, HEIGHT);
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(-1);
}
// Setup an XNA like background color
GL11.glClearColor(0.4f, 0.6f, 0.9f, 0f);
// Map the internal OpenGL coordinate system to the entire screen
GL11.glViewport(0, 0, WIDTH, HEIGHT);
this.exitOnGLError("setupOpenGL");
}