Java 类org.lwjgl.opengl.PixelFormat 实例源码

项目:trashjam2017    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:trashjam2017    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:MRCEngine    文件:DisplayManager.java   
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();

}
项目:Progetto-C    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:Progetto-C    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:LowPolyWater    文件:Window.java   
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();
    }
}
项目:BaseClient    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:BaseClient    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:BaseClient    文件:Minecraft.java   
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();
    }
}
项目:LowPolyTerrain    文件:Window.java   
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();
    }
}
项目:Terrain    文件:DisplayManager.java   
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);
}
项目:OpenGL-Animation    文件:DisplayManager.java   
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();
}
项目:EcoSystem-Official    文件:Window.java   
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();
    }
}
项目:3d-Engine    文件:DisplayManager.java   
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();
}
项目:TRHS_Club_Mod_2016    文件:ForgeHooksClient.java   
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;
    }
}
项目:PhET    文件:StartupUtils.java   
/**
 * @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;
}
项目:PhET    文件:JMEUtils.java   
/**
 * @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;
}
项目:CauldronGit    文件:ForgeHooksClient.java   
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;
    }
}
项目:uosl    文件:GameView.java   
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();
}
项目:code404    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:code404    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:ldparteditor    文件:OpenGL3_TheQuadTextured.java   
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");
}
项目:Resilience-Client-Source    文件:WrUpdaterThreaded.java   
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);
        }
    }
}
项目:tribaltrouble    文件:SerializableDisplayMode.java   
private final static void createWindow() throws LWJGLException {
    int[] depth_array = new int[]{24, 16};
    int[] samples_array = new int[]{/*Settings.getSettings().samples, */0};
    LWJGLException last_exception = new LWJGLException("Could not find a suitable pixel format");
    for (int d = 0; d < depth_array.length; d++)
        for (int s = 0; s < samples_array.length; s++) {
            int depth = depth_array[d];
            int samples = samples_array[s];
            try {
                Display.create(new PixelFormat(0, depth, 0, samples));
                return;
            } catch (LWJGLException e) {
                last_exception = e;
                System.out.println("Failed window: depthbits = " + depth + " | samples = " + samples + " with exception " + e);
            }
        }
    throw last_exception;
}
项目:tribaltrouble    文件:PbufferRenderer.java   
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;
    }
}
项目:fuzzy-octo-shame    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:fuzzy-octo-shame    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:CommunityGame    文件:Window.java   
public static void createWindow( int width, int height, String title )
{
    Display.setTitle( title );
    try
    {
        Display.setDisplayMode( new DisplayMode( width, height ) );
        Display.setVSyncEnabled( true );
        Display.setResizable( true );
        Display.create( new PixelFormat( 0, 0, 0, 8 ) );
        Keyboard.create();
        Mouse.create();
    }
    catch ( LWJGLException e )
    {
        e.printStackTrace();
    }
}
项目:Cauldron    文件:ForgeHooksClient.java   
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;
    }
}
项目:Cauldron    文件:ForgeHooksClient.java   
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;
    }
}
项目:Cauldron    文件:ForgeHooksClient.java   
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;
    }
}
项目:Fusion    文件:OpenGL30Context.java   
@Override
public void create() {
    try {
        // Get the desktop display mode
        final DisplayMode mode = Display.getDesktopDisplayMode();
        // Create the pixel format
        final PixelFormat format = new PixelFormat(mode.getBitsPerPixel(), 8, 8, 0, 0);
        // Create the context attrib
        ContextAttribs attribs = new ContextAttribs(getGLVersion().getMajor(), getGLVersion().getMinor());
        attribs = attribs.withProfileCore(true);
        attribs = attribs.withDebug(true);
        // Create the display
        Display.create(format, attribs);
        super.create();
    } catch (LWJGLException ex) {
        throw new IllegalStateException("Unable to create display!", ex);
    }
    setWindowTitle("Fusion Engine | Version: " + Engine.ENGINE_VERSION);
    setClearColour(0.0f, 0.35f, 0.75f);
    setWindowSize(800, 600);
    enableVSync(true);
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:GPVM    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:GPVM    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}
项目:GPVM    文件:PBufferUniqueGraphics.java   
/**
 * 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?");
    }
}
项目:AchternEngine    文件:LWJGLWindow.java   
@Override
public void create(String title) {
    setTitle(title);
    enableResize(true);

    PixelFormat pixelFormat = new PixelFormat();
    ContextAttribs contextAtrributes = new ContextAttribs(3, 2)
            .withForwardCompatible(true)
            .withProfileCore(true);

    try {
        Display.setDisplayMode(new DisplayMode(getWidth(), getHeight()));
        Display.create(pixelFormat, contextAtrributes);
        Keyboard.create();
        Mouse.create();
        AL.create();
        drawBuffer = glGetInteger(GL_DRAW_BUFFER);
        readBuffer = glGetInteger(GL_READ_BUFFER);
    } catch (LWJGLException e) {
        LOGGER.error("Error setting up input and window", e);
    }
}
项目:RuneCraftery    文件:ForgeHooksClient.java   
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);
    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;
    }
}
项目:RuneCraftery    文件:ForgeHooksClient.java   
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);
    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;
    }
}
项目:SpaceStationAlpha    文件:PBufferGraphics.java   
/**
 * 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?");
    }
}