Paul_Pander
Paul_Pander

Reputation: 7

Fullscreen Frame Borders in Java LWJGL

I want to make a game with Java and LWJGL. In many videogames you can see the black fields at the top and the bottom of the display, which is used to size the display in the resolution the game can work with.

I searched for this two days, but maybe I used wrong keywords.

So is there any possibility I can make this with LWJGL. Maybe a method I can use?

Upvotes: 1

Views: 78

Answers (1)

Jay Evans
Jay Evans

Reputation: 36

Its a very good idea to use a 2D Shader with Black Materials and Textures that render in front of your game. Seperate from the Shader you use to render your game scene.

Steps:

  1. Get the windows height and width variables:

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

float screenwidth = vidmode.width(); float screenheight = vidmode.height();

  1. Make a 2D Shader seperate from your InGame Vertex Shader

  2. Convert the screen coordinates to 2D OpenGL Coordinates

  3. With the 2D Shader. Make 2 Black Rectangles. Compared to the width and height of the screen

Upvotes: 0

Related Questions