當前位置: 首頁>>代碼示例>>Java>>正文


Java PixelFormat類代碼示例

本文整理匯總了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?");
	}
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:28,代碼來源:PBufferGraphics.java

示例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?");
	}
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:28,代碼來源:PBufferUniqueGraphics.java

示例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();
	
}
 
開發者ID:marcioz98,項目名稱:MRCEngine,代碼行數:19,代碼來源:DisplayManager.java

示例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();
	}
}
 
開發者ID:TheThinMatrix,項目名稱:LowPolyWater,代碼行數:20,代碼來源:Window.java

示例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();
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:23,代碼來源:Minecraft.java

示例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);
}
 
開發者ID:DevipriyaSarkar,項目名稱:Terrain,代碼行數:17,代碼來源:DisplayManager.java

示例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();
}
 
開發者ID:TheThinMatrix,項目名稱:OpenGL-Animation,代碼行數:17,代碼來源:DisplayManager.java

示例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();
    }
}
 
開發者ID:GryPLOfficial,項目名稱:EcoSystem-Official,代碼行數:20,代碼來源:Window.java

示例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();
}
 
開發者ID:MrManiacc,項目名稱:3d-Engine,代碼行數:17,代碼來源:DisplayManager.java

示例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;
    }
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:26,代碼來源:ForgeHooksClient.java

示例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;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:20,代碼來源:StartupUtils.java

示例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;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:20,代碼來源:JMEUtils.java

示例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;
    }
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:23,代碼來源:ForgeHooksClient.java

示例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();
}
 
開發者ID:necr0potenc3,項目名稱:uosl,代碼行數:27,代碼來源:GameView.java

示例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");
}
 
開發者ID:nilsschmidt1337,項目名稱:ldparteditor,代碼行數:27,代碼來源:OpenGL3_TheQuadTextured.java


注:本文中的org.lwjgl.opengl.PixelFormat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。