package com.io7m.jcanephora; import java.nio.ByteBuffer; import java.nio.ByteOrder; import javax.media.opengl.DebugGL2; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; public final class CheckUnits implements GLEventListener { private final GLWindow window; CheckUnits() throws InterruptedException { final GLProfile profile = GLProfile.getGL2GL3(); final GLCapabilities requested_caps = new GLCapabilities(profile); requested_caps.setStencilBits(8); requested_caps.setDepthBits(24); requested_caps.setRedBits(8); requested_caps.setBlueBits(8); requested_caps.setGreenBits(8); this.window = GLWindow.create(requested_caps); this.window.setSize(640, 480); this.window.setVisible(true); this.window.setTitle(this.getClass().getName()); this.window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyNotify( @SuppressWarnings("unused") final WindowEvent e) { System.exit(0); } }); this.window.addGLEventListener(this); while (this.window.isVisible()) { Thread.sleep(100); } } public static void main( final String args[]) throws InterruptedException { new CheckUnits(); } @Override public void init( final GLAutoDrawable drawable) { final GL2 gl = new DebugGL2(drawable.getGL().getGL2()); final GLContext context = drawable.getContext(); System.out.println("VERSION_MAJOR : " + context.getGLVersionMajor()); System.out.println("VERSION_MINOR : " + context.getGLVersionMinor()); System.out.println(context.isGLCoreProfile()); System.out.println("Chosen caps : " + this.window.getChosenGLCapabilities()); System.out.println("INIT GL : " + gl); System.out.println("GL_VENDOR : " + gl.glGetString(GL.GL_VENDOR)); System.out.println("GL_RENDERER : " + gl.glGetString(GL.GL_RENDERER)); System.out.println("GL_VERSION : " + gl.glGetString(GL.GL_VERSION)); final ByteBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()); gl.glGetIntegerv(GL2ES2.GL_MAX_TEXTURE_IMAGE_UNITS, buffer.asIntBuffer()); final int count = buffer.getInt(0); System.out.println("GL_MAX_TEXTURE_IMAGE_UNITS: " + count); } @Override public void dispose( final GLAutoDrawable drawable) { // TODO Auto-generated method stub } @Override public void display( final GLAutoDrawable drawable) { // TODO Auto-generated method stub } @Override public void reshape( final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { // TODO Auto-generated method stub } }