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

项目: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();

}
项目:FreeWorld    文件:FreeWorld.java   
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();
}
项目: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    文件:Config.java   
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;
}
项目:BaseClient    文件:Config.java   
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;
}
项目:lwjgl_collection    文件:Display2.java   
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);
}
项目:lwjgl_collection    文件:DisplayTest.java   
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);
    }
}
项目:Proyecto-DASI    文件:VideoHook.java   
/**
 * 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);
}
项目:Proyecto-DASI    文件:VideoHook.java   
/**
 * 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);
}
项目: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);
}
项目:Towan    文件:Artist.java   
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);
}
项目:Backmemed    文件:Config.java   
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;
}
项目:Backmemed    文件:Config.java   
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];
    }
}
项目:Backmemed    文件:Config.java   
public static DisplayMode getDisplayMode(Dimension p_getDisplayMode_0_) throws LWJGLException
{
    DisplayMode[] adisplaymode = getDisplayModes();

    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)
        {
            return displaymode;
        }
    }

    return desktopDisplayMode;
}
项目: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();
}
项目:opsu-dance    文件:GLHelper.java   
/**
 * 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;
}
项目:PhET    文件:PickingTest.java   
/**
 * Sets the display mode for fullscreen mode
 */
private boolean setDisplayMode() {
    try {
        // get modes
        DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes( width, height, -1, -1, -1, -1, 60, 60 );

        org.lwjgl.util.Display.setDisplayMode( dm, new String[] {
                "width=" + width,
                "height=" + height,
                "freq=" + 60,
                "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
        } );

        return true;

    }
    catch ( Exception e ) {
        e.printStackTrace();
        System.out.println( "Unable to enter fullscreen, continuing in windowed mode" );
    }

    return false;
}
项目:PhET    文件:Game.java   
/**
  * Sets the display mode for fullscreen mode
 */
private boolean setDisplayMode() {
   try {
    // get modes
    DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(width, height, -1, -1, -1, -1, 60, 60);

     org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
         "width=" + width,
         "height=" + height,
         "freq=" + 60,
         "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
        });
     return true;
   } catch (Exception e) {
     e.printStackTrace();
     System.out.println("Unable to enter fullscreen, continuing in windowed mode");
   }

    return false;
}
项目:PhET    文件:BasicTest.java   
/**
 * Sets the display mode for fullscreen mode
 */
protected boolean setDisplayMode() {
  try {
// get modes
DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60);

    org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
        "width=" + 640,
        "height=" + 480,
        "freq=" + 60,
        "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
       });
    return true;
  } catch (Exception e) {
    e.printStackTrace();
  }

  return false;
}
项目:PhET    文件:MouseCreationTest.java   
/**
 * Sets the display mode for fullscreen mode
 */
protected boolean setDisplayMode() {
  try {
// get modes
DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60);

    org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
        "width=" + 640,
        "height=" + 480,
        "freq=" + 60,
        "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
       });
    return true;
  } catch (Exception e) {
    e.printStackTrace();
  }

  return false;
}
项目:PhET    文件:HWCursorTest.java   
/**
 * Sets the display mode for fullscreen mode
 */
protected boolean setDisplayMode() {
    try {
        // get modes
        DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60);

        org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
                "width=" + 640,
                "height=" + 480,
                "freq=" + 60,
                "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
        });
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }

    return false;
}
项目:PhET    文件:KeyboardTest.java   
/**
 * Sets the display mode for fullscreen mode
 */
protected boolean setDisplayMode() {
  try {
// get modes
DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60);

    org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
        "width=" + 640,
        "height=" + 480,
        "freq=" + 60,
        "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
       });
    return true;
  } catch (Exception e) {
    e.printStackTrace();
  }

  return false;
}
项目:PhET    文件:DisplayTest.java   
/**
 * Tests querying for modes
 */
private void queryModesTest() throws LWJGLException {
  DisplayMode[] modes = null;

  System.out.println("==== Test query ====");
  System.out.println("Retrieving available displaymodes");
  modes = Display.getAvailableDisplayModes();

  // no modes check
  if (modes == null) {
    System.out.println("FATAL: unable to find any modes!");
    System.exit(-1);
  }

  // write some info
  System.out.println("Found " + modes.length + " modes");
  System.out.println("The first 5 are:");
  for(int i=0;i<modes.length; i++) {
    System.out.println(modes[i]);
    if (i == 5) {
      break;
    }
  }
  System.out.println("---- Test query ----");
}
项目:PhET    文件:LwjglDisplay.java   
protected DisplayMode getFullscreenDisplayMode(int width, int height, int bpp, int freq){
    try {
        DisplayMode[] modes = Display.getAvailableDisplayModes();
        for (DisplayMode mode : modes){
            if (mode.getWidth() == width
             && mode.getHeight() == height
             && (mode.getBitsPerPixel() == bpp || (bpp==24&&mode.getBitsPerPixel()==32))
             && mode.getFrequency() == freq){
                return mode;
            }
        }
    } catch (LWJGLException ex) {
        listener.handleError("Failed to acquire fullscreen display mode!", ex);
    }
    return null;
}
项目:malmo    文件:VideoHook.java   
/**
 * 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 {
        int old_x = Display.getX();
        int old_y = Display.getY();
        Display.setLocation(old_x, old_y);
        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);
}
项目:Factorization    文件:MiscClientTickHandler.java   
public void notifyTimeOnFullScreen() {
    if (!FzConfig.show_time_on_fullscreen) return;
    if (interval <= 0) return;
    long now = getNow();
    if (now == old_now || now == -1) return;
    old_now = now;
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.isFullScreen()) {
        DisplayMode desktop = Display.getDesktopDisplayMode();
        if (desktop.getWidth() != mc.displayWidth || desktop.getHeight() != mc.displayHeight) {
            return;
        }
    }
    DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
    String msg = df.format(new Date());
    if (!mentioned_disabling) {
        msg += " (via FZ)";
        mentioned_disabling = true;
    }
    ChatStyle style = new ChatStyle().setItalic(true).setColor(EnumChatFormatting.GRAY);
    mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(msg).setChatStyle(style), 20392);
    last_msg = msg;
}
项目:synergynet3.1    文件:DisplayConfigPanel.java   
/**
 * Gets the display modes.
 *
 * @return the display modes
 */
private DisplayMode[] getDisplayModes()
{
    DisplayMode[] modes = null;
    try
    {
        AppSettings settings = new AppSettings(true);
        JmeSystem.initialize(settings);
        modes = Display.getAvailableDisplayModes();
        Arrays.sort(modes, new DisplayModeComparator());
        Display.destroy();
    }
    catch (LWJGLException e)
    {
        e.printStackTrace();
    }
    return modes;
}
项目:synergynet3.1    文件:DisplayConfigPanel.java   
/**
 * Inits the display selector.
 */
private void initDisplaySelector()
{
    // get the saved display mode as loading the list causes a change
    DisplayMode currentMode = getCurrentDisplayMode(getDisplayModes());

    displaySelector.removeAllItems();
    for (DisplayMode dm : getDisplayModes())
    {
        displaySelector.addItem(dm);
    }

    if (currentMode == null)
    {
        // we didn't already have a display, pick the first
        currentMode = getDisplayModes()[0];
    }

    // restore saved display mode
    setSelectedDisplayMode(currentMode);
    displaySelector.setSelectedIndex(getCurrentDisplayModeIndex(getDisplayModes()));
}
项目:synergynet3.1    文件:DisplayModeComparator.java   
@Override
public int compare(DisplayMode a, DisplayMode b)
{
    if (a.getWidth() != b.getWidth())
    {
        return (a.getWidth() > b.getWidth()) ? 1 : -1;
    }
    if (a.getHeight() != b.getHeight())
    {
        return (a.getHeight() > b.getHeight()) ? 1 : -1;
    }
    if (a.getBitsPerPixel() != b.getBitsPerPixel())
    {
        return (a.getBitsPerPixel() > b.getBitsPerPixel()) ? 1 : -1;
    }
    if (a.getFrequency() != b.getFrequency())
    {
        return (a.getFrequency() > b.getFrequency()) ? 1 : -1;
    }
    return 0;
}
项目:SRPG    文件:Artist.java   
public static void BeginSession() {
    Display.setTitle("SRPG");
    try {
        Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
        Display.create();
    }
    catch (LWJGLException e){
        e.printStackTrace();
    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WIDTH, HEIGHT, 0, 1, -1); //Top Left is (0, 0)
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
项目:star-droids    文件:Artist.java   
/**
* Constructor para inicializar los datos
* 
* @author Alba Ríos
*/
public static void BeginSession(){
    Display.setTitle("Star Droids"); //Screen title
    try {
        Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); //Screen dimension
        Display.create(); //Screen creation
    } catch (LWJGLException ex) {
        Logger.getLogger(MapProject.class.getName()).log(Level.SEVERE, null, ex);
    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_TEXTURE_2D);
}
项目: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    文件:Config.java   
public static DisplayMode getDisplayMode(Dimension dim) throws LWJGLException
{
    DisplayMode[] modes = Display.getAvailableDisplayModes();

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

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

    return desktopDisplayMode;
}
项目:golems    文件:DisplayModeTab.java   
private List<Integer> getFrequencies()
{
    List<DisplayMode> modes = resolutionMap.get(getSelectedResolution());
    List<Integer> freqs = new ArrayList<Integer>();

    if (modes != null)
    {
        for (DisplayMode mode:modes)
        {
            if (getSelectedBitsPerPixel()<0 || mode.getBitsPerPixel() == getSelectedBitsPerPixel())
            {
                if (!freqs.contains(mode.getFrequency()))
                    freqs.add(mode.getFrequency());
            }
        }
    }
    Collections.sort(freqs);
    return freqs;
}
项目:golems    文件:DisplayModeTab.java   
private List<Integer> getBits()
{
    List<DisplayMode> modes = resolutionMap.get(getSelectedResolution());
    List<Integer> bits = new ArrayList<Integer>();

    if (modes != null)
    {
        for (DisplayMode mode:modes)
        {
            if (getSelectedFrequency()<0 ||  mode.getFrequency() == getSelectedFrequency())
            {
                if (!bits.contains(mode.getBitsPerPixel()))
                    bits.add(mode.getBitsPerPixel());
            }
        }
    }
    Collections.sort(bits);
    return bits;
}
项目:GPVM    文件:MouseCreationTest.java   
/**
 * Sets the display mode for fullscreen mode
 */
protected boolean setDisplayMode() {
  try {
// get modes
DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60);

    org.lwjgl.util.Display.setDisplayMode(dm, new String[] {
        "width=" + 640,
        "height=" + 480,
        "freq=" + 60,
        "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()
       });
    return true;
  } catch (Exception e) {
    e.printStackTrace();
  }

  return false;
}
项目:GPVM    文件:DisplayTest.java   
/**
 * Tests querying for modes
 */
private void queryModesTest() throws LWJGLException {
  DisplayMode[] modes = null;

  System.out.println("==== Test query ====");
  System.out.println("Retrieving available displaymodes");
  modes = Display.getAvailableDisplayModes();

  // no modes check
  if (modes == null) {
    System.out.println("FATAL: unable to find any modes!");
    System.exit(-1);
  }

  // write some info
  System.out.println("Found " + modes.length + " modes");
  System.out.println("The first 5 are:");
  for(int i=0;i<modes.length; i++) {
    System.out.println(modes[i]);
    if (i == 5) {
      break;
    }
  }
  System.out.println("---- Test query ----");
}