use of com.jogamp.opengl.JoglVersion in project constellation by constellation-app.
the class JoglVersionAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final GLProfile glProfile = SharedDrawable.getGLProfile();
// Create GLContext and trigger GLContext object creation and native realization.
final GLAutoDrawable drawable = GLDrawableFactory.getFactory(glProfile).createDummyAutoDrawable(null, true, new GLCapabilities(glProfile), null);
drawable.display();
drawable.getContext().makeCurrent();
final GL gl = drawable.getGL().getGL3();
final StringBuilder sb = new StringBuilder();
sb.append(String.format("OpenGL version: %s\n", gl.glGetString(GL.GL_VERSION)));
sb.append(String.format("Vendor: %s\n", gl.glGetString(GL.GL_VENDOR)));
sb.append(String.format("Renderer: %s\n", gl.glGetString(GL.GL_RENDERER)));
if (gl instanceof GL2ES2) {
sb.append(String.format("Shading language version: %s\n", gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION)));
}
final JoglVersion jv = JoglVersion.getInstance();
final Set<?> names = jv.getAttributeNames();
final ArrayList<String> lines = new ArrayList<>();
for (final Object name : names) {
lines.add(String.format("%s: %s\n", name, jv.getAttribute((Attributes.Name) name)));
}
Collections.sort(lines);
sb.append("\nJOGL Attributes\n");
for (final String line : lines) {
sb.append(line);
}
sb.append("\nGL Strings\n");
JoglVersion.getGLStrings(gl, sb, true);
sb.append(SeparatorConstants.NEWLINE);
final InfoTextPanel itp = new InfoTextPanel(sb.toString());
final NotifyDescriptor.Message msg = new NotifyDescriptor.Message(itp);
msg.setTitle(Bundle.CTL_JoglVersionAction());
DialogDisplayer.getDefault().notify(msg);
}
Aggregations