当前位置: 首页>>代码示例>>Java>>正文


Java DisplayMode类代码示例

本文整理汇总了Java中org.lwjgl.opengl.DisplayMode的典型用法代码示例。如果您正苦于以下问题:Java DisplayMode类的具体用法?Java DisplayMode怎么用?Java DisplayMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DisplayMode类属于org.lwjgl.opengl包,在下文中一共展示了DisplayMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDisplay

import org.lwjgl.opengl.DisplayMode; //导入依赖的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

示例2: main

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
public static void main(String... args){
    System.setProperty("org.lwjgl.librarypath", new File("native/"+(System.getProperties().getProperty("os.name").split(" ")[0]).toLowerCase()).getAbsolutePath());

    FreeWorld.getFreeWorld();

    try {
        Display.setTitle(FreeWorld.getFreeWorld().getTitle());
        Display.setDisplayMode(new DisplayMode(720, 480));
        Display.setResizable(true);
        Display.create();
    }catch (LWJGLException e){
        e.printStackTrace();
    }

    //TODO: Provisoire
    glClearColor(0.2f, 0.7f, 0.7f, 1.0f);

    FreeWorld.getFreeWorld().start();
}
 
开发者ID:Vinetos,项目名称:FreeWorld,代码行数:20,代码来源:FreeWorld.java

示例3: Window

import org.lwjgl.opengl.DisplayMode; //导入依赖的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

示例4: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
public static DisplayMode getDisplayMode(Dimension p_getDisplayMode_0_) throws LWJGLException
{
    DisplayMode[] adisplaymode = Display.getAvailableDisplayModes();

    for (int i = 0; i < adisplaymode.length; ++i)
    {
        DisplayMode displaymode = adisplaymode[i];

        if (displaymode.getWidth() == p_getDisplayMode_0_.width && displaymode.getHeight() == p_getDisplayMode_0_.height && (desktopDisplayMode == null || displaymode.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && displaymode.getFrequency() == desktopDisplayMode.getFrequency()))
        {
            return displaymode;
        }
    }

    return desktopDisplayMode;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:Config.java

示例5: main

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		Display.setDisplayMode(new DisplayMode(640, 480));
		Display.setTitle("A Fresh New Display");
		Display.create();
	} catch (LWJGLException e) {
		e.printStackTrace();
		Display.destroy();
		System.exit(1);
	}
	while (!Display.isCloseRequested()) {
		// render code
		// input handling code
		 
		// refresh display and poll input
		Display.update();
		// Maintain a 60fps frame rate
		Display.sync(60);
	}
	Display.destroy();
	System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:23,代码来源:Display2.java

示例6: main

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		Display.setDisplayMode(new DisplayMode(640, 480));
		Display.setTitle("Display Test");
		Display.create();
		// create() throws LWJGLException
	} catch (LWJGLException e) {
		System.err.println("Display wasn't initialized correctly.");
		// Throws an exit code of 1
		System.exit(1);
	}
	// While nobody is trying to close the window
	while (!Display.isCloseRequested()) {
		Display.update();
		// FPS is the parameter
		Display.sync(60);
	}
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:19,代码来源:DisplayTest.java

示例7: resizeIfNeeded

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
/**
 * Resizes the window and the Minecraft rendering if necessary. Set renderWidth and renderHeight first.
 */
private void resizeIfNeeded()
{
    // resize the window if we need to
    int oldRenderWidth = Display.getWidth(); 
    int oldRenderHeight = Display.getHeight();
    if( this.renderWidth == oldRenderWidth && this.renderHeight == oldRenderHeight )
        return;
    
    try {
        Display.setDisplayMode(new DisplayMode(this.renderWidth, this.renderHeight));
        System.out.println("Resized the window");
    } catch (LWJGLException e) {
        System.out.println("Failed to resize the window!");
        e.printStackTrace();
    }
    forceResize(this.renderWidth, this.renderHeight);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:VideoHook.java

示例8: createDisplay

import org.lwjgl.opengl.DisplayMode; //导入依赖的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

示例9: BeginSession

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
public static void BeginSession(){
	Display.setTitle(TITLE);
	try {
		Display.setDisplayMode(new DisplayMode(WIDTH + MENU_WIDTH, HEIGHT));
		Display.create();
	} catch (LWJGLException e) {
		e.printStackTrace();
	}
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, WIDTH + MENU_WIDTH, HEIGHT, 0, 1, -1);
	glMatrixMode(GL_MODELVIEW);
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
 
开发者ID:imaTowan,项目名称:Towan,代码行数:18,代码来源:Artist.java

示例10: getDisplayModes

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
private static DisplayMode[] getDisplayModes(DisplayMode[] p_getDisplayModes_0_, Dimension p_getDisplayModes_1_)
{
    List list = new ArrayList();

    for (int i = 0; i < p_getDisplayModes_0_.length; ++i)
    {
        DisplayMode displaymode = p_getDisplayModes_0_[i];

        if ((double)displaymode.getWidth() == p_getDisplayModes_1_.getWidth() && (double)displaymode.getHeight() == p_getDisplayModes_1_.getHeight())
        {
            list.add(displaymode);
        }
    }

    DisplayMode[] adisplaymode = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()]));
    return adisplaymode;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:Config.java

示例11: getDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
private static DisplayMode getDisplayMode(DisplayMode[] p_getDisplayMode_0_, DisplayMode p_getDisplayMode_1_)
{
    if (p_getDisplayMode_1_ != null)
    {
        for (int i = 0; i < p_getDisplayMode_0_.length; ++i)
        {
            DisplayMode displaymode = p_getDisplayMode_0_[i];

            if (displaymode.getBitsPerPixel() == p_getDisplayMode_1_.getBitsPerPixel() && displaymode.getFrequency() == p_getDisplayMode_1_.getFrequency())
            {
                return displaymode;
            }
        }
    }

    if (p_getDisplayMode_0_.length <= 0)
    {
        return null;
    }
    else
    {
        Arrays.sort(p_getDisplayMode_0_, new DisplayModeComparator());
        return p_getDisplayMode_0_[p_getDisplayMode_0_.length - 1];
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:Config.java

示例12: createDisplay

import org.lwjgl.opengl.DisplayMode; //导入依赖的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

示例13: Window

import org.lwjgl.opengl.DisplayMode; //导入依赖的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

示例14: createDisplay

import org.lwjgl.opengl.DisplayMode; //导入依赖的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

示例15: findFullscreenDisplayMode

import org.lwjgl.opengl.DisplayMode; //导入依赖的package包/类
/**
 * from org.newdawn.slick.AppGameContainer#setDisplayMode
 */
public static DisplayMode findFullscreenDisplayMode(int targetBPP, int targetFrequency, int width, int height) throws LWJGLException {
	DisplayMode[] modes = Display.getAvailableDisplayModes();
	DisplayMode foundMode = null;
	int freq = 0;
	int bpp = 0;

	for (DisplayMode current : modes) {
		if (current.getWidth() != width || current.getHeight() != height) {
			continue;
		}

		if (current.getBitsPerPixel() == targetBPP && current.getFrequency() == targetFrequency) {
			return current;
		}

		if (current.getFrequency() >= freq && (foundMode == null || current.getBitsPerPixel() >= bpp)) {
			foundMode = current;
			freq = foundMode.getFrequency();
			bpp = foundMode.getBitsPerPixel();
		}
	}
	return foundMode;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:27,代码来源:GLHelper.java


注:本文中的org.lwjgl.opengl.DisplayMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。