当前位置: 首页>>代码示例>>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;未经允许,请勿转载。