Tag Info

New answers tagged


glViewport() specifies the part of the window to which OpenGL will draw (in pixels). glOrtho() specifies the projection matrix to use inside the viewport. To make the coordinates specified by glOrtho() fill the whole window, you would call glViewport(0,0,windowWidth,windowHeight);. Or alternately, not call glViewport() at all, since OpenGL's default ...


It might help if you knew that the viewport defines the region (in terms of window-space coordinates) where your scene is projected to. If you had no projection matrix at all, then the coordinates (-1,-1) would map to the lower-left corner of your viewport and the coordinates (1,1) would map to the top-right. We call that coordinate space "Normalized Device ...


change int[] indices = new int[(TILES_WIDE * 6 * TILES_HIGH) - ((TILES_WIDE + 1) * 6)]; to int[] indices = new int[((TILES_WIDE-1) * 6 * (TILES_HIGH-1)]; And then a proper x,y iteration over (TILES_WIDE-1), (TILES_HIGH-1) to set the indices.


Make sure you request a depth buffer from LWJGL by passing a PixelFormat to your call of Display.create. Like so: Display.create(new PixelFormat(4,24,0,4)); The 24 indicates a 24 bit depth buffer.


I had forgotten to ask for a depth buffer when creating my window: Before: Display.create(new PixelFormat(4,0,0,4)); After Display.create(new PixelFormat(4,24,0,4));

Top 50 recent answers are included