Adding a getPixelFormat method to the Display class would be a nice convenience. Sometimes it might be desirable to know exactly the format that we are working with rather than the minimum requested (i.e. do I actually have a 24-bit depth buffer instead of the minimum 16-bit I asked for).
Use glGetInteger:
int r = GLUtils.getGLInteger(GL11.GL_RED_BITS);
int g = GLUtils.getGLInteger(GL11.GL_GREEN_BITS);
int b = GLUtils.getGLInteger(GL11.GL_BLUE_BITS);
int a = GLUtils.getGLInteger(GL11.GL_ALPHA_BITS);
int depth = GLUtils.getGLInteger(GL11.GL_DEPTH_BITS);
int stencil = GLUtils.getGLInteger(GL11.GL_STENCIL_BITS);
- elias
Interesting. I never even considered all of that would be available through the OpenGL API. I've always used GetPixelFormat on Windows, or SDL_GL_GetAttribute through SDL. Thanks for pointing that out.