Reputation: 7
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
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:
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
float screenwidth = vidmode.width(); float screenheight = vidmode.height();
Make a 2D Shader seperate from your InGame Vertex Shader
Convert the screen coordinates to 2D OpenGL Coordinates
With the 2D Shader. Make 2 Black Rectangles. Compared to the width and height of the screen
Upvotes: 0