コード例 #1
0
 /**
  * Sets the Z-buffer state on the given node.
  *
  * <p>NOTE: This method assumes it is being called in a MT-Safe manner.
  */
 private void setZBufferState(Node node) {
   RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
   ZBufferState zbuf = (ZBufferState) rm.createRendererState(RenderState.StateType.ZBuffer);
   zbuf.setEnabled(true);
   zbuf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
   node.setRenderState(zbuf);
 }
コード例 #2
0
  /** Return true if we support high-quality avatars */
  public static boolean supportsHighQualityAvatars() {
    String shaderCheck = System.getProperty("avatar.shaderCheck");
    boolean shaderPass = true;

    // Check to see if the system supports OpenGL 2.0. If not, then
    // always use the low-detail avatar character
    RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
    if (shaderCheck != null && shaderCheck.equals("true")) {
      shaderPass = rm.getContextCaps().GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB >= 512;
    }

    // Issue 1114: make sure the system is telling the truth about what
    // it supports by trying a mock shader program
    boolean uniformsPass = shaderPass && ShaderTest.getInstance().testShaders();

    logger.warning(
        "Checking avatar detail level.  OpenGL20: "
            + rm.supportsOpenGL20()
            + " ShaderCheck: "
            + shaderPass
            + " UniformsCheck: "
            + uniformsPass);

    // OWL issue #110 -- ignore the value of supportsOpenGL20() here. This
    // is known to report false negatives on at least one graphics card.
    // Our shader test should do an adequate job determining whether a
    // graphics card supports the OpenGL 2.0 features we use.

    // Update: fixed version of supportsOpenGL20 should properly detect
    // version.

    return rm.supportsOpenGL20() && shaderPass && uniformsPass;
  }