IntBuffer viewport = BufferUtils.createIntBuffer(4);GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);System.out.println("viewport: " + viewport.get() + " " + viewport.get() + " " + viewport.get() + " " + viewport.get());
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Number of remaining buffer elements is 4, must be at least 16 at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:162) at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:189) at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:244) at org.lwjgl.opengl.GL11.glGetInteger(GL11.java:1355)
As the error message indicates - glGetInteger requires a buffer with 16 remaining slots. This is the maximum number of values which OpenGL's glGetInteger can return.
GL_VIEWPORT params returns four values: the x and y window coordinates of the viewport, followed by its width and height. Initially the x and y window coordinates are both set to 0, and the width and height are set to the width and height of the window into which the GL will do its rendering. See glViewport.
You can also make LWJGL work like a), by passing the org.lwjgl.util.NoChecks=true VM parameter.