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

项目:trashjam2017    文件:AppletGameContainer.java   
/**
 * Start a thread to run LWJGL in
 */
public void startLWJGL() {
   if (gameThread != null) {
      return;
   }

   gameThread = new Thread() {
      public void run() {
         try {
            canvas.start();
         }
         catch (Exception e) {
            e.printStackTrace();
            if (Display.isCreated()) {
               Display.destroy();
            }
            displayParent.setVisible(false);//removeAll();
            add(new ConsolePanel(e));
            validate();
         }
      }
   };

   gameThread.start();
}
项目:BaseClient    文件:Minecraft.java   
protected void checkWindowResize() {
    if (!this.fullscreen && Display.wasResized()) {
        int i = this.displayWidth;
        int j = this.displayHeight;
        this.displayWidth = Display.getWidth();
        this.displayHeight = Display.getHeight();

        if (this.displayWidth != i || this.displayHeight != j) {
            if (this.displayWidth <= 0) {
                this.displayWidth = 1;
            }

            if (this.displayHeight <= 0) {
                this.displayHeight = 1;
            }

            this.resize(this.displayWidth, this.displayHeight);
        }
    }
}
项目:Backmemed    文件:Minecraft.java   
/**
 * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen
 * currently displayed
 */
public void setIngameFocus()
{
    if (Display.isActive())
    {
        if (!this.inGameHasFocus)
        {
            if (!IS_RUNNING_ON_MAC)
            {
                KeyBinding.updateKeyBindState();
            }

            this.inGameHasFocus = true;
            this.mouseHelper.grabMouseCursor();
            this.displayGuiScreen((GuiScreen)null);
            this.leftClickCounter = 10000;
        }
    }
}
项目: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   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    // Bind the texture after rendering.
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
                          image.getTexture().getTextureWidth(), 
                          image.getTexture().getTextureHeight(), 0);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:trashjam2017    文件:ParticleGame.java   
public void update(GameContainer container, int delta)
        throws SlickException {
    if (!paused) {
        ypos += delta * 0.002 * systemMove;
        if (ypos > 300) {
            ypos = -300;
        }
        if (ypos < -300) {
            ypos = 300;
        }

        for (int i = 0; i < emitters.size(); i++) {
            ((ConfigurableEmitter) emitters.get(i)).replayCheck();
        }
        for (int i = 0; i < delta; i++) {
            system.update(1);
        }
    }

    Display.sync(100);
}
项目:OpenGL-Bullet-engine    文件:ShaderRenderer.java   
protected Matrix4f getProjection(){
    Renderer r=getRenderer();
    if(r!=null) return r.getProjection();

    float farPlane=1000,nearPlane=0.1F;
    float aspectRatio=(float)Display.getWidth()/(float)Display.getHeight();
    float y_scale=(float)(1f/Math.tan(Math.toRadians(60/2f))*aspectRatio);
    float x_scale=y_scale/aspectRatio;
    float frustum_length=farPlane-nearPlane;

    NULL_PROJECTION.setIdentity();
    NULL_PROJECTION.m00=x_scale;
    NULL_PROJECTION.m11=y_scale;
    NULL_PROJECTION.m22=-((farPlane+nearPlane)/frustum_length);
    NULL_PROJECTION.m23=-1;
    NULL_PROJECTION.m32=-(2*nearPlane*farPlane/frustum_length);
    NULL_PROJECTION.m33=0;

    return NULL_PROJECTION;
}
项目:Backmemed    文件:Minecraft.java   
public void addServerStatsToSnooper(Snooper playerSnooper)
{
    playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS));
    playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync));
    playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency()));
    playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed");
    playerSnooper.addClientStat("run_time", Long.valueOf((MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat("current_action", this.getCurrentAction());
    playerSnooper.addClientStat("language", this.gameSettings.language == null ? "en_us" : this.gameSettings.language);
    String s = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big";
    playerSnooper.addClientStat("endianness", s);
    playerSnooper.addClientStat("subtitles", Boolean.valueOf(this.gameSettings.showSubtitles));
    playerSnooper.addClientStat("touch", this.gameSettings.touchscreen ? "touch" : "mouse");
    playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size()));
    int i = 0;

    for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries())
    {
        playerSnooper.addClientStat("resource_pack[" + i++ + "]", resourcepackrepository$entry.getResourcePackName());
    }

    if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null)
    {
        playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID());
    }
}
项目: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    文件:Minecraft.java   
/**
 * Shuts down the minecraft applet by stopping the resource downloads, and
 * clearing up GL stuff; called when the application (or web page) is exited.
 */
public void shutdownMinecraftApplet() {
    try {
        this.stream.shutdownStream();
        logger.info("Stopping!");

        Client.getClient().onDisable();

        try {
            this.loadWorld((WorldClient) null);
        } catch (Throwable var5) {
            ;
        }

        this.mcSoundHandler.unloadSounds();
    } finally {
        Display.destroy();

        if (!this.hasCrashed) {
            System.exit(0);
        }
    }

    System.gc();
}
项目: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);
}
项目:Progetto-C    文件:AppGameContainer.java   
/**
 * Indicate whether we want to be in fullscreen mode. Note that the current
 * display mode must be valid as a fullscreen mode for this to work
 * 
 * @param fullscreen True if we want to be in fullscreen mode
 * @throws SlickException Indicates we failed to change the display mode
 */
public void setFullscreen(boolean fullscreen) throws SlickException {
    if (isFullscreen() == fullscreen) {
        return;
    }

    if (!fullscreen) {
        try {
            Display.setFullscreen(fullscreen);
        } catch (LWJGLException e) {
            throw new SlickException("Unable to set fullscreen="+fullscreen, e);
        }
    } else {
        setDisplayMode(width, height, fullscreen);
    }
    getDelta();
}
项目:BaseClient    文件:PBufferGraphics.java   
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
    GL.flush();

    // Bind the texture after rendering.
    GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
    pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);

    try {
        Display.makeCurrent();
    } catch (LWJGLException e) {
        Log.error(e);
    }

    SlickCallable.leaveSafeBlock();
}
项目:BaseClient    文件:Minecraft.java   
protected void checkWindowResize()
{
    if (!this.fullscreen && Display.wasResized())
    {
        int i = this.displayWidth;
        int j = this.displayHeight;
        this.displayWidth = Display.getWidth();
        this.displayHeight = Display.getHeight();

        if (this.displayWidth != i || this.displayHeight != j)
        {
            if (this.displayWidth <= 0)
            {
                this.displayWidth = 1;
            }

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }

            this.resize(this.displayWidth, this.displayHeight);
        }
    }
}
项目:featurea    文件:MyLwjglCanvas.java   
protected int getFrameRate() {
    int frameRate = Display.isActive() ? this.graphics.config.foregroundFPS : this.graphics.config.backgroundFPS;
    if (frameRate == -1) {
        frameRate = 10;
    }

    if (frameRate == 0) {
        frameRate = this.graphics.config.backgroundFPS;
    }

    if (frameRate == 0) {
        frameRate = 30;
    }

    return frameRate;
}
项目:BaseClient    文件:Minecraft.java   
public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper)
{
    playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS));
    playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync));
    playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency()));
    playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed");
    playerSnooper.addClientStat("run_time", Long.valueOf((MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat("current_action", this.func_181538_aA());
    String s = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big";
    playerSnooper.addClientStat("endianness", s);
    playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size()));
    int i = 0;

    for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries())
    {
        playerSnooper.addClientStat("resource_pack[" + i++ + "]", resourcepackrepository$entry.getResourcePackName());
    }

    if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null)
    {
        playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID());
    }
}
项目:BaseClient    文件:Minecraft.java   
public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) {
    playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS));
    playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync));
    playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency()));
    playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed");
    playerSnooper.addClientStat("run_time", Long.valueOf(
            (MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat("current_action", this.func_181538_aA());
    String s = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big";
    playerSnooper.addClientStat("endianness", s);
    playerSnooper.addClientStat("resource_packs",
            Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size()));
    int i = 0;

    for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository
            .getRepositoryEntries()) {
        playerSnooper.addClientStat("resource_pack[" + i++ + "]",
                resourcepackrepository$entry.getResourcePackName());
    }

    if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null) {
        playerSnooper.addClientStat("snooper_partner",
                this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID());
    }
}
项目:CustomWorldGen    文件:SplashProgress.java   
/**
 * @deprecated not a stable API, will break, don't use this yet
 */
@Deprecated
public static void resume()
{
    if(!enabled) return;
    checkThreadState();
    pause = false;
    try
    {
        Display.getDrawable().releaseContext();
        d.makeCurrent();
    }
    catch (LWJGLException e)
    {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
    lock.unlock();
}
项目: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;
}
项目:CustomWorldGen    文件:Minecraft.java   
protected void checkWindowResize()
{
    if (!this.fullscreen && Display.wasResized())
    {
        int i = this.displayWidth;
        int j = this.displayHeight;
        this.displayWidth = Display.getWidth();
        this.displayHeight = Display.getHeight();

        if (this.displayWidth != i || this.displayHeight != j)
        {
            if (this.displayWidth <= 0)
            {
                this.displayWidth = 1;
            }

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }

            this.resize(this.displayWidth, this.displayHeight);
        }
    }
}
项目:DecompiledMinecraft    文件:Minecraft.java   
protected void checkWindowResize()
{
    if (!this.fullscreen && Display.wasResized())
    {
        int i = this.displayWidth;
        int j = this.displayHeight;
        this.displayWidth = Display.getWidth();
        this.displayHeight = Display.getHeight();

        if (this.displayWidth != i || this.displayHeight != j)
        {
            if (this.displayWidth <= 0)
            {
                this.displayWidth = 1;
            }

            if (this.displayHeight <= 0)
            {
                this.displayHeight = 1;
            }

            this.resize(this.displayWidth, this.displayHeight);
        }
    }
}
项目:DecompiledMinecraft    文件:Minecraft.java   
public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper)
{
    playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS));
    playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync));
    playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency()));
    playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed");
    playerSnooper.addClientStat("run_time", Long.valueOf((MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
    playerSnooper.addClientStat("current_action", this.func_181538_aA());
    String s = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big";
    playerSnooper.addClientStat("endianness", s);
    playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size()));
    int i = 0;

    for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries())
    {
        playerSnooper.addClientStat("resource_pack[" + i++ + "]", resourcepackrepository$entry.getResourcePackName());
    }

    if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null)
    {
        playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID());
    }
}
项目:ThunderingSky    文件:Play.java   
public static void main(String[] args) {
    AppGameContainer gameContainer;
    try {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        width = (int)screenSize.getWidth();
        height = (int)screenSize.getHeight();
        gameContainer = new AppGameContainer(new Play(gamename));
        gameContainer.setVSync(true); // Should probably stay true for performance
        gameContainer.setDisplayMode(width, height, true);
        gameContainer.setTargetFrameRate(fps);
        gameContainer.setShowFPS(showFps);
        Display.setInitialBackground(1, 1, 1);
        gameContainer.start();
    } catch(SlickException e) {
        e.printStackTrace();
    }
}
项目:Towan    文件:Boot.java   
public Boot(){

    // BeginSession Call initializes OpenGL calls
    BeginSession();

    // Main game loop
    while(!Display.isCloseRequested()){
        Clock.Update();
        StateManager.Update();
        Display.update();
        Display.sync(60);
    }
    Display.destroy();
}
项目:OpenGL-Animation    文件:DisplayManager.java   
public static void update() {
    Display.sync(FPS_CAP);
    Display.update();
    long currentFrameTime = getCurrentTime();
    delta = (currentFrameTime - lastFrameTime) / 1000f;
    lastFrameTime = currentFrameTime;
}
项目:BaseClient    文件:Config.java   
public static DisplayMode[] getFullscreenDisplayModes()
{
    try
    {
        DisplayMode[] adisplaymode = Display.getAvailableDisplayModes();
        List list = new ArrayList();

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

            if (desktopDisplayMode == null || displaymode.getBitsPerPixel() == desktopDisplayMode.getBitsPerPixel() && displaymode.getFrequency() == desktopDisplayMode.getFrequency())
            {
                list.add(displaymode);
            }
        }

        DisplayMode[] adisplaymode1 = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()]));
        Comparator comparator = new Comparator()
        {
            public int compare(Object p_compare_1_, Object p_compare_2_)
            {
                DisplayMode displaymode1 = (DisplayMode)p_compare_1_;
                DisplayMode displaymode2 = (DisplayMode)p_compare_2_;
                return displaymode1.getWidth() != displaymode2.getWidth() ? displaymode2.getWidth() - displaymode1.getWidth() : (displaymode1.getHeight() != displaymode2.getHeight() ? displaymode2.getHeight() - displaymode1.getHeight() : 0);
            }
        };
        Arrays.sort(adisplaymode1, comparator);
        return adisplaymode1;
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
        return new DisplayMode[] {desktopDisplayMode};
    }
}
项目:trashjam2017    文件:AppletGameContainer.java   
/**
 * The running game loop
 * 
 * @throws Exception Indicates a failure within the game's loop rather than the framework
 */
public void runloop() throws Exception {
   while (running) {
      int delta = getDelta();

      updateAndRender(delta);

      updateFPS();
      Display.update();
   }

   Display.destroy();
}
项目:lwjgl_collection    文件:StateDemo.java   
private StateDemo() {

    try {
        Display.setDisplayMode(new DisplayMode(640, 480));
        Display.setTitle("Game States");
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 640, 480, 0, 1, -1);
    glMatrixMode(GL_MODELVIEW);

    while (!Display.isCloseRequested()) {
        // Render Code here
        glClear(GL_COLOR_BUFFER_BIT);

        render();
        checkInput();

        Display.update();
        Display.sync(60);
    }

    Display.destroy();
    System.exit(0);
}
项目:CustomWorldGen    文件:Minecraft.java   
private void setInitialDisplayMode() throws LWJGLException
{
    if (this.fullscreen)
    {
        Display.setFullscreen(true);
        DisplayMode displaymode = Display.getDisplayMode();
        this.displayWidth = Math.max(1, displaymode.getWidth());
        this.displayHeight = Math.max(1, displaymode.getHeight());
    }
    else
    {
        Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
    }
}
项目:Zombe-Modpack    文件:Minecraft.java   
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
项目:EcoSystem-Official    文件:Window.java   
public void setResolution(DisplayMode resolution, boolean fullscreen) {
    try {
        Display.setDisplayMode(resolution);
        this.resolution = resolution;
        if (fullscreen && resolution.isFullscreenCapable()) {
            Display.setFullscreen(true);
            this.fullScreen = fullscreen;
        }
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
}
项目:BaseClient    文件:Config.java   
public static void checkInitialized()
{
    if (!initialized)
    {
        if (Display.isCreated())
        {
            initialized = true;
            checkOpenGlCaps();
            startVersionCheckThread();
        }
    }
}
项目:trashjam2017    文件:TestUtils.java   
/**
 * Initialise the GL display
 * 
 * @param width The width of the display
 * @param height The height of the display
 */
private void initGL(int width, int height) {
    try {
        Display.setDisplayMode(new DisplayMode(width,height));
        Display.create();
        Display.setVSyncEnabled(true);
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);        
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);                    

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                
       GL11.glClearDepth(1);                                       

       GL11.glEnable(GL11.GL_BLEND);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

       GL11.glViewport(0,0,width,height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, height, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
项目:MRCEngine    文件:MasterRenderer.java   
private void createProjectionMatrix() {
    float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
    float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
    float x_scale = y_scale / aspectRatio;
    float frustum_lenght = FAR_PLANE - NEAR_PLANE;

    projectionMatrix = new Matrix4f();
    projectionMatrix.m00 = x_scale;
    projectionMatrix.m11 = y_scale;
    projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_lenght);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_lenght);
    projectionMatrix.m33 = 0;
}
项目:EcoSystem-Official    文件:Window.java   
private void getSuitableFullScreenModes() throws LWJGLException {
    DisplayMode[] resolutions = Display.getAvailableDisplayModes();
    DisplayMode desktopResolution = Display.getDesktopDisplayMode();
    for (DisplayMode resolution : resolutions) {
        if (isSuitableFullScreenResolution(resolution, desktopResolution)) {
            availableResolutions.add(resolution);
        }
    }
}
项目:BaseClient    文件:AppGameContainer.java   
public Object run() {
            try {
                Display.getDisplayMode();
            } catch (Exception e) {
                Log.error(e);
            }
return null;
        }
项目:Terrain    文件:MasterRenderer.java   
private void createProjectionMatrix() {
    float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
    float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
    float x_scale = y_scale / aspectRatio;
    float frustum_length = FAR_PLANE - NEAR_PLANE;

    projectionMatrix = new Matrix4f();
    projectionMatrix.m00 = x_scale;
    projectionMatrix.m11 = y_scale;
    projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
    projectionMatrix.m33 = 0;
}
项目:FreeWorld    文件:FreeWorld.java   
private void run(){
    long lns = System.nanoTime();
    double ns = 1000000000.0/20.0;
    long ls = System.currentTimeMillis();
    int fps = 0, tps = 0;


    while (!Display.isCloseRequested() && running) {
        if(System.nanoTime() - lns > ns){
            lns+=ns;
            tps++;
            update();
        }else{
            fps++;
            render();
            Display.update();
        }

        if(System.currentTimeMillis() - ls >= 1000){
            ls = System.currentTimeMillis();
            Display.setTitle(title+" | FPS : "+fps+" | TPS : "+tps);
            fps = 0; tps = 0;
        }
    }

    Display.destroy();
    System.exit(0);
}
项目:FreeWorld    文件:FreeWorld.java   
private void render(){
    if(Display.wasResized()) glViewport(0, 0, Display.getWidth(), Display.getHeight());

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);

    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);

    GLU.gluPerspective(70.0f, (float) Display.getWidth() / (float) Display.getHeight(), 0.01f, 1000.0f);

    glEnable(GL_DEPTH_TEST);
    glPopMatrix();
        glPushAttrib(GL_TRANSFORM_BIT);

            glRotatef(player.getLocation().getYaw(), 1, 0, 0);
            glRotatef(player.getLocation().getPitch(), 0, 1, 0);
            glTranslatef(-player.getLocation().getX(), -player.getLocation().getY(), -player.getLocation().getZ());

            Renderer.renderWorld(world);
            Renderer.renderRayCast(player);

        glPopAttrib();
    glPopMatrix();
    glDisable(GL_DEPTH_TEST);

    renderGUI();
}
项目:Zombe-Modpack    文件:Minecraft.java   
private void createDisplay() throws LWJGLException
{
    Display.setResizable(true);
    Display.setTitle("Minecraft 1.11");

    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();
    }
}