context/renderer: let renderer print out graphics hardware info

experimental
shadowislord 10 years ago
parent bbbfdb851a
commit eda5e983da
  1. 2
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java
  2. 47
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  3. 26
      jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@ -115,6 +115,7 @@ public interface GL {
public static final int GL_OUT_OF_MEMORY = 0x505;
public static final int GL_POINTS = 0x0;
public static final int GL_POLYGON_OFFSET_FILL = 0x8037;
public static final int GL_RENDERER = 0x1F01;
public static final int GL_REPEAT = 0x2901;
public static final int GL_REPLACE = 0x1E01;
public static final int GL_RGB = 0x1907;
@ -171,6 +172,7 @@ public interface GL {
public static final int GL_UNSIGNED_SHORT = 0x1403;
public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
public static final int GL_VENDOR = 0x1F00;
public static final int GL_VERSION = 0x1F02;
public static final int GL_VERTEX_SHADER = 0x8B31;
public static final int GL_ZERO = 0x0;

@ -130,6 +130,11 @@ public class GLRenderer implements Renderer {
return caps;
}
// Not making public yet ...
public EnumMap<Limits, Integer> getLimits() {
return limits;
}
private static HashSet<String> loadExtensions(String extensions) {
HashSet<String> extensionSet = new HashSet<String>(64);
for (String extension : extensions.split(" ")) {
@ -418,13 +423,33 @@ public class GLRenderer implements Renderer {
caps.add(Caps.SeamlessCubemap);
}
if (hasExtension("GL_ARB_get_program_binary")) {
// OK ..
int binaryFormats = getInteger(GLExt.GL_NUM_PROGRAM_BINARY_FORMATS);
System.out.println("Binary Formats: " + binaryFormats);
}
// if (hasExtension("GL_ARB_get_program_binary")) {
// int binaryFormats = getInteger(GLExt.GL_NUM_PROGRAM_BINARY_FORMATS);
// }
logger.log(Level.FINE, "Caps: {0}", caps);
// Print context information
logger.log(Level.INFO, "OpenGL Renderer Information\n" +
" * Vendor: {0}\n" +
" * Renderer: {1}\n" +
" * OpenGL Version: {2}\n" +
" * GLSL Version: {3}",
new Object[]{
gl.glGetString(GL.GL_VENDOR),
gl.glGetString(GL.GL_RENDERER),
gl.glGetString(GL.GL_VERSION),
gl.glGetString(GL.GL_SHADING_LANGUAGE_VERSION)
});
// Print capabilities (if fine logging is enabled)
if (logger.isLoggable(Level.FINE)) {
StringBuilder sb = new StringBuilder();
sb.append("Supported capabilities: \n");
for (Caps cap : caps)
{
sb.append("\t").append(cap.toString()).append("\n");
}
logger.log(Level.FINE, sb.toString());
}
texUtil.initialize(caps);
}
@ -1094,14 +1119,22 @@ public class GLRenderer implements Renderer {
needRegister = true;
}
// If using GLSL 1.5, we bind the outputs for the user
// For versions 3.3 and up, user should use layout qualifiers instead.
boolean bindFragDataRequired = false;
for (ShaderSource source : shader.getSources()) {
if (source.isUpdateNeeded()) {
updateShaderSourceData(source);
}
if (source.getType() == ShaderType.Fragment
&& source.getLanguage().equals("GLSL150")) {
bindFragDataRequired = true;
}
gl.glAttachShader(id, source.getId());
}
if (caps.contains(Caps.OpenGL30) && gl3 != null) {
if (bindFragDataRequired) {
// Check if GLSL version is 1.5 for shader
gl3.glBindFragDataLocation(id, 0, "outFragColor");
// For MRT

@ -84,25 +84,13 @@ public abstract class LwjglContext implements JmeContext {
}
protected void printContextInitInfo() {
logger.log(Level.INFO, "Lwjgl {0} context running on thread {1}",
new Object[]{Sys.getVersion(), Thread.currentThread().getName()});
logger.log(Level.INFO, "Adapter: {0}", Display.getAdapter());
logger.log(Level.INFO, "Driver Version: {0}", Display.getVersion());
String vendor = GL11.glGetString(GL11.GL_VENDOR);
logger.log(Level.INFO, "Vendor: {0}", vendor);
String version = GL11.glGetString(GL11.GL_VERSION);
logger.log(Level.INFO, "OpenGL Version: {0}", version);
String renderGl = GL11.glGetString(GL11.GL_RENDERER);
logger.log(Level.INFO, "Renderer: {0}", renderGl);
if (GLContext.getCapabilities().OpenGL20){
String shadingLang = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
logger.log(Level.INFO, "GLSL Ver: {0}", shadingLang);
}
logger.log(Level.INFO, "LWJGL {0} context running on thread {1}\n" +
" * Graphics Adapter: {2}\n" +
" * Driver Version: {3}\n" +
" * Scaling Factor: {4}",
new Object[]{ Sys.getVersion(), Thread.currentThread().getName(),
Display.getAdapter(), Display.getVersion(),
Display.getPixelScaleFactor() });
}
protected ContextAttribs createContextAttribs() {

Loading…
Cancel
Save