org.lwjgl.opengl.Display Java Examples

The following examples show how to use org.lwjgl.opengl.Display. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoHook.java    From malmo with MIT License 6 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: AppletGameContainer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Start the game container
 * 
 * @throws Exception Failure to create display
 */
public void start() throws Exception {
   Display.setParent(displayParent);
   Display.setVSyncEnabled(true);
   
   try {
      createDisplay();
   } catch (LWJGLException e) {
      e.printStackTrace();
      // failed to create Display, apply workaround (sleep for 1 second) and try again
      Thread.sleep(1000);
      createDisplay();
   }
   
   initGL();
   displayParent.requestFocus();
   container.runloop();
}
 
Example #3
Source File: ParticleGame.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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);
}
 
Example #4
Source File: LevelEditor.java    From FEMultiplayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void loop() {
	while(!Display.isCloseRequested()) {
		time = System.nanoTime();
		glClear(GL_COLOR_BUFFER_BIT |
		        GL_DEPTH_BUFFER_BIT |
		        GL_STENCIL_BUFFER_BIT);
		glClearDepth(1.0f);
		getInput();
		glPushMatrix();
		if(!paused) {
			currentStage.beginStep();
			currentStage.onStep();
			currentStage.processAddStack();
			currentStage.processRemoveStack();
			Renderer.getCamera().lookThrough();
			currentStage.render();
			currentStage.endStep();
		}
		glPopMatrix();
		Display.update();
		timeDelta = System.nanoTime()-time;
	}
	AL.destroy();
	Display.destroy();
}
 
Example #5
Source File: HyperiumMinecraft.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void displayFix(CallbackInfo ci, boolean fullscreen, int displayWidth, int displayHeight)
    throws LWJGLException {
    Display.setFullscreen(false);
    if (fullscreen) {
        if (Settings.WINDOWED_FULLSCREEN) {
            System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
        } else {
            Display.setFullscreen(true);
            DisplayMode displaymode = Display.getDisplayMode();
            parent.displayWidth = Math.max(1, displaymode.getWidth());
            parent.displayHeight = Math.max(1, displaymode.getHeight());
        }
    } else {
        if (Settings.WINDOWED_FULLSCREEN) {
            System.setProperty("org.lwjgl.opengl.Window.undecorated", "false");
        } else {
            Display.setDisplayMode(new DisplayMode(displayWidth, displayHeight));
        }
    }

    Display.setResizable(false);
    Display.setResizable(true);

    // effectively overwrites the method
    ci.cancel();
}
 
Example #6
Source File: LwjglContext.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected void printContextInitInfo(){
    logger.log(Level.FINE, "Running on thread: {0}", Thread.currentThread().getName());

    logger.log(Level.INFO, "Adapter: {0}", Display.getAdapter());
    logger.log(Level.INFO, "Driver Version: {0}", Display.getVersion());

    String vendor = GL11.glGetString(GL11.GL_VENDOR);
    logger.log(Level.INFO, "Vendor: {0}", vendor);

    String version = GL11.glGetString(GL11.GL_VERSION);
    logger.log(Level.INFO, "OpenGL Version: {0}", version);

    String renderGl = GL11.glGetString(GL11.GL_RENDERER);
    logger.log(Level.INFO, "Renderer: {0}", renderGl);

    if (GLContext.getCapabilities().OpenGL20){
        String shadingLang = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
        logger.log(Level.INFO, "GLSL Ver: {0}", shadingLang);
    }
}
 
Example #7
Source File: Example3_2.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void resized() {
	int w = Display.getWidth(), h = Display.getHeight();
	
	if(h == 0)
		h = 1;
	
	glViewport(0, 0, Display.getWidth(), Display.getHeight());
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	float aspect = (float)w / h;
	if(w <= h)
		glOrtho(-100, 100, -100 / aspect, 100 / aspect, 100, -100);
	else
		glOrtho(-100 * aspect, 100 * aspect, -100, 100, 100, -100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
 
Example #8
Source File: Example3_3.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void resized() {
	int w = Display.getWidth(), h = Display.getHeight();
	
	if(h == 0)
		h = 1;
	
	glViewport(0, 0, Display.getWidth(), Display.getHeight());
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	float aspect = (float)w / h;
	if(w <= h)
		glOrtho(-100, 100, -100 / aspect, 100 / aspect, 100, -100);
	else
		glOrtho(-100 * aspect, 100 * aspect, -100, 100, 100, -100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
 
Example #9
Source File: Renderer.java    From tribaltrouble with GNU General Public License v2.0 6 votes vote down vote up
private final void initVisibleGL() {
	if (Settings.getSettings().fullscreen_depth_workaround) {
		IntBuffer dummy_buf = BufferUtils.createIntBuffer(1);
		GL11.glReadPixels(0, 0, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_UNSIGNED_INT, dummy_buf);
	}

	FloatBuffer float_array = BufferUtils.createFloatBuffer(4);
	GL11.glEnable(GL11.GL_LIGHT0);
	float[] light_diff_color = {1.0f, 1.0f, 1.0f, 1.0f};
	float_array.put(light_diff_color);
	float_array.rewind();
	GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, float_array);
	GL11.glLightModeli(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, 1);

	float[] global_ambient = {0.65f, 0.65f, 0.65f, 1.0f};
	float_array.put(global_ambient);
	float_array.rewind();
	GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, float_array);
	float[] material_color = {1.0f, 1.0f, 1.0f, 1.0f};
	float_array.put(material_color);
	float_array.rewind();
	GL11.glMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE, float_array);
	Display.update();
}
 
Example #10
Source File: URacerDesktopFinalizer.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
@Override
public void dispose () {
	boot.load();
	boot.setWindowX(Display.getX());
	boot.setWindowY(Display.getY());
	boot.store();

	// destroy display
	Display.destroy();

	// destroy audio, if any
	if (this.audio != null) {
		this.audio.dispose();
		this.audio = null;
	}
}
 
Example #11
Source File: GameRanking.java    From opsu with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void enter(GameContainer container, StateBasedGame game)
		throws SlickException {
	UI.enter();
	Display.setTitle(game.getTitle());
	if (!data.isGameplay()) {
		if (!MusicController.isTrackDimmed())
			MusicController.toggleTrackDimmed(0.5f);
		replayButton.setY(retryY);
		animationProgress.setTime(animationProgress.getDuration());
	} else {
		SoundController.playSound(SoundEffect.APPLAUSE);
		retryButton.resetHover();
		if (GameMod.AUTO.isActive()) {
			replayButton.setY(retryY);
			animationProgress.setTime(animationProgress.getDuration());
		} else {
			replayButton.setY(replayY);
			animationProgress.setTime(0);
		}
	}
	replayButton.resetHover();
	loadReplay();
}
 
Example #12
Source File: Example3_5.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void resized() {
	int w = Display.getWidth(), h = Display.getHeight();
	
	if(h == 0)
		h = 1;
	
	glViewport(0, 0, Display.getWidth(), Display.getHeight());
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	float aspect = (float)w / h;
	if(w <= h)
		glOrtho(-100, 100, -100 / aspect, 100 / aspect, 100, -100);
	else
		glOrtho(-100 * aspect, 100 * aspect, -100, 100, 100, -100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
 
Example #13
Source File: ClientProxy.java    From Fullscreen-Windowed-Minecraft with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Rectangle findCurrentScreenDimensionsAndPosition(int x, int y)
    {
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] screens = env.getScreenDevices();

        for(GraphicsDevice dev : screens)
        {
            GraphicsConfiguration displayMode = dev.getDefaultConfiguration();
            Rectangle bounds = displayMode.getBounds();

            if(bounds.contains(x, y))
                return bounds;
        }

        //if Java isn't able to find a matching screen then use the old LWJGL calcs.
        return new Rectangle(0, 0, Display.getDesktopDisplayMode().getWidth(), Display.getDesktopDisplayMode().getHeight());
}
 
Example #14
Source File: Example3_4.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void resized() {
	int w = Display.getWidth(), h = Display.getHeight();
	
	if(h == 0)
		h = 1;
	
	glViewport(0, 0, Display.getWidth(), Display.getHeight());
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	float aspect = (float)w / h;
	if(w <= h)
		glOrtho(-100, 100, -100 / aspect, 100 / aspect, 100, -100);
	else
		glOrtho(-100 * aspect, 100 * aspect, -100, 100, 100, -100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
 
Example #15
Source File: SerializableDisplayMode.java    From tribaltrouble with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #16
Source File: PBufferUniqueGraphics.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * 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?");
	}
}
 
Example #17
Source File: DisplayManager.java    From OpenGL-Animation with The Unlicense 6 votes vote down vote up
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();
}
 
Example #18
Source File: Example3_6.java    From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void resized() {
	int w = Display.getWidth(), h = Display.getHeight();
	
	if(h == 0)
		h = 1;
	
	glViewport(0, 0, Display.getWidth(), Display.getHeight());
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	float aspect = (float)w / h;
	if(w <= h)
		glOrtho(-100, 100, -100 / aspect, 100 / aspect, 100, -100);
	else
		glOrtho(-100 * aspect, 100 * aspect, -100, 100, 100, -100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
 
Example #19
Source File: AppletGameContainer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * 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();
}
 
Example #20
Source File: TestUtils.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Start the test 
 */
public void start() {
	initGL(800,600);
	init();
	
	while (true) {
		update();
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
		render();
		
		Display.update();
		Display.sync(100);

		if (Display.isCloseRequested()) {
			System.exit(0);
		}
	}
}
 
Example #21
Source File: FEMultiplayer.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
	public void loop() {
		while(!Display.isCloseRequested()) {
			final long time = System.nanoTime();
			glClear(GL_COLOR_BUFFER_BIT |
			        GL_DEPTH_BUFFER_BIT |
			        GL_STENCIL_BUFFER_BIT);
			glClearDepth(1.0f);
			getInput();
			final ArrayList<Message> messages = new ArrayList<>();
			if(client != null){
				synchronized (client.messagesLock) {
					messages.addAll(client.messages);
					for(Message m : messages)
						client.messages.remove(m);
				}
			}
			SoundStore.get().poll(0);
			glPushMatrix();
			//Global resolution scale
//			Renderer.scale(scaleX, scaleY);
				currentStage.beginStep(messages);
				currentStage.onStep();
				currentStage.processAddStack();
				currentStage.processRemoveStack();
				currentStage.render();
//				FEResources.getBitmapFont("stat_numbers").render(
//						(int)(1.0f/getDeltaSeconds())+"", 440f, 0f, 0f);
				currentStage.endStep();
				postRenderRunnables.runAll();
			glPopMatrix();
			Display.update();
			Display.sync(FEResources.getTargetFPS());
			timeDelta = System.nanoTime()-time;
		}
		AL.destroy();
		Display.destroy();
		if(client != null && client.isOpen()) client.quit();
	}
 
Example #22
Source File: Window.java    From LowPolyWater with The Unlicense 5 votes vote down vote up
private void getSuitableFullScreenModes() throws LWJGLException {
	DisplayMode[] resolutions = Display.getAvailableDisplayModes();
	DisplayMode desktopResolution = Display.getDesktopDisplayMode();
	for (DisplayMode resolution : resolutions) {
		if (isSuitableFullScreenResolution(resolution, desktopResolution)) {
			availableResolutions.add(resolution);
		}
	}
}
 
Example #23
Source File: Fbo.java    From LowPolyWater with The Unlicense 5 votes vote down vote up
/**
 * Copy the contents of a colour attachment of this FBO to the screen.
 * 
 * @param colourIndex
 *            - The index of the colour buffer that should be blitted.
 */
public void blitToScreen(int colourIndex) {
	GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0);
	GL11.glDrawBuffer(GL11.GL_BACK);
	GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, fboId);
	GL11.glReadBuffer(GL30.GL_COLOR_ATTACHMENT0 + colourIndex);
	GL30.glBlitFramebuffer(0, 0, width, height, 0, 0, Display.getWidth(), Display.getHeight(),
			GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);
	GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
 
Example #24
Source File: SerializableDisplayMode.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
private final static void doSetMode(SerializableDisplayMode target_mode) throws LWJGLException {
	DisplayMode[] lwjgl_modes = Display.getAvailableDisplayModes();
	for (int i = 0; i < lwjgl_modes.length; i++) {
		DisplayMode lwjgl_mode = lwjgl_modes[i];
		SerializableDisplayMode mode = new SerializableDisplayMode(lwjgl_mode);
		if (mode.equals(target_mode)) {
			nativeSetMode(lwjgl_mode);
			GL11.glViewport(0, 0, lwjgl_mode.getWidth(), lwjgl_mode.getHeight());
			return;
		}
	}
	throw new LWJGLException("Could not find mode matching: " + target_mode);
}
 
Example #25
Source File: GuiListChat.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
/**
 * Handle Mouse Input
 */
@Override
public void handleMouseInput() {
	super.handleMouseInput();

	if (!Display.isActive()) // Don't allow multiple URL-Clicks if Display is not focused.
		return;

	int mouseX = this.i;
	int mouseY = this.j;

	if (this.g(mouseY)) {
		if (Mouse.isButtonDown(0) && this.q()) {
			int y = mouseY - this.d - this.t + (int) this.n - 4;
			int id = -1;
			int minY = -1;
			// Search for the right ChatLine-ID
			for (int i1 = 0; i1 < heightMap.size(); i1++) {
				Integer integer = heightMap.get(i1);
				Row line = rows.get(i1);
				if (y >= integer - 2 && y <= integer + line.getLineHeight() - 2) {
					id = i1;
					minY = integer;
					break;
				}
			}

			if (id < 0 || id >= rows.size())
				return;

			callback.chatLineClicked(rows.get(id), mouseX, y, minY, getLeft());
		}
	}
}
 
Example #26
Source File: Main.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public final static void fail(Throwable t) {
	try {
		t.printStackTrace();
		if (Display.isCreated())
			Display.destroy();
		while (t.getCause() != null)
			t = t.getCause();
		ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());
		String error = Utils.getBundleString(bundle, "error");
		String error_msg = Utils.getBundleString(bundle, "error_message", new Object[]{t.toString(), Globals.SUPPORT_ADDRESS});
		Sys.alert(error, error_msg);
	} finally {
		shutdown();
	}
}
 
Example #27
Source File: Camera.java    From OpenGL-Animation with The Unlicense 5 votes vote down vote up
private static Matrix4f createProjectionMatrix() {
	Matrix4f projectionMatrix = new Matrix4f();
	float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
	float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))));
	float x_scale = y_scale / aspectRatio;
	float frustum_length = FAR_PLANE - NEAR_PLANE;

	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;
	return projectionMatrix;
}
 
Example #28
Source File: GuiListChat.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
/**
 * Handle Mouse Input
 */
@Override
public void handleMouseInput() {
	super.handleMouseInput();

	if (!Display.isActive()) // Don't allow multiple URL-Clicks if Display is not focused.
		return;

	int mouseX = this.i;
	int mouseY = this.j;

	if (this.g(mouseY)) {
		if (Mouse.isButtonDown(0) && this.q()) {
			int y = mouseY - this.d - this.t + (int) this.n - 4;
			int id = -1;
			int minY = -1;
			// Search for the right ChatLine-ID
			for (int i1 = 0; i1 < heightMap.size(); i1++) {
				Integer integer = heightMap.get(i1);
				Row line = rows.get(i1);
				if (y >= integer - 2 && y <= integer + line.getLineHeight() - 2) {
					id = i1;
					minY = integer;
					break;
				}
			}

			if (id < 0 || id >= rows.size())
				return;

			callback.chatLineClicked(rows.get(id), mouseX, y, minY, getLeft());
		}
	}
}
 
Example #29
Source File: LwjglGraphicsModule.java    From tprogers2048game with GNU General Public License v3.0 5 votes vote down vote up
private void initOpengl() {
      try {
          /* Задаём размер будущего окна */
          Display.setDisplayMode(new DisplayMode(Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT));

          /* Задаём имя будущего окна */
          Display.setTitle(Constants.SCREEN_NAME);

          /* Создаём окно */
          Display.create();
      } catch (LWJGLException e) {
          ErrorCatcher.graphicsFailure(e);
      }

      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0, Constants.SCREEN_WIDTH,0, Constants.SCREEN_HEIGHT,1,-1);
      glMatrixMode(GL_MODELVIEW);

/* Для поддержки текстур */
      glEnable(GL_TEXTURE_2D);

/* Для поддержки прозрачности */
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

/* Белый фоновый цвет */
      glClearColor(1,1,1,1);
  }
 
Example #30
Source File: SerializableDisplayMode.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
private final static void nativeSetMode(DisplayMode mode) throws LWJGLException {
		if (!Display.getDisplayMode().equals(mode)) {
System.out.println("setting mode = " + mode);
			Display.setDisplayMode(mode);
			Renderer.resetInput();
		}
	}