com.jme3.system.AppSettings.getRenderer()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中com.jme3.system.AppSettings.getRenderer()方法的一些代码示例,展示了AppSettings.getRenderer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppSettings.getRenderer()方法的具体详情如下:
包路径:com.jme3.system.AppSettings
类名称:AppSettings
方法名:getRenderer

AppSettings.getRenderer介绍

[英]Get the renderer
[中]获取渲染器

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private JmeContext newContextCustom(AppSettings settings, JmeContext.Type type) {
  try {
    String className = settings.getRenderer().substring("CUSTOM".length());
    Class<? extends JmeContext> ctxClazz = null;
    ctxClazz = (Class<? extends JmeContext>) Class.forName(className);
    return ctxClazz.newInstance();
  } catch (InstantiationException ex) {
    logger.log(Level.SEVERE, "Failed to create context", ex);
  } catch (IllegalAccessException ex) {
    logger.log(Level.SEVERE, "Failed to create context", ex);
  } catch (ClassNotFoundException ex) {
    logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!", ex);
  }
  return null;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public JmeContext newContext(AppSettings settings, Type contextType) {
  initialize(settings);
  JmeContext ctx;
  if (settings.getRenderer() == null
      || settings.getRenderer().equals("NULL")
      || contextType == JmeContext.Type.Headless) {
    ctx = new NullContext();
    ctx.setSettings(settings);
  } else if (settings.getRenderer().startsWith("LWJGL")) {
    ctx = newContextLwjgl(settings, contextType);
    ctx.setSettings(settings);
  } else if (settings.getRenderer().startsWith("JOGL")) {
    ctx = newContextJogl(settings, contextType);
    ctx.setSettings(settings);
  } else if (settings.getRenderer().startsWith("CUSTOM")) {
    ctx = newContextCustom(settings, contextType);
    ctx.setSettings(settings);
  } else {
    throw new UnsupportedOperationException(
        "Unrecognizable renderer specified: "
        + settings.getRenderer());
  }
  return ctx;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public JmeContext newContext(AppSettings settings, JmeContext.Type contextType) {
  initialize(settings);
  JmeContext ctx = null;
  if (settings.getRenderer() == null
      || settings.getRenderer().equals("NULL")
      || contextType == JmeContext.Type.Headless) {
    ctx = new NullContext();
    ctx.setSettings(settings);
  } else {
    ctx = new IGLESContext();
    ctx.setSettings(settings);
  }
  return ctx;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected ContextAttribs createContextAttribs() {
  if (settings.getBoolean("GraphicsDebug") || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
    ContextAttribs attr;
    if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
      attr = new ContextAttribs(3, 2);
      attr = attr.withProfileCore(true).withForwardCompatible(true).withProfileCompatibility(false);
    } else {
      attr = new ContextAttribs();
    }
    if (settings.getBoolean("GraphicsDebug")) {
      attr = attr.withDebug(true);
    }
    return attr;
  } else {
    return null;
  }
}
protected int determineMaxSamples(int requestedSamples) {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected void initContextFirstTime() {
  final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3));
  if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
      || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
    GL gl = new LwjglGL();
    GLExt glext = new LwjglGLExt();
    renderer.initialize();
  } else {
    throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
  profile = GLProfile.getMaxProgrammable(true);
} else {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
    || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
  GL gl = new LwjglGL();
  GLExt glext = new LwjglGLExt();
  renderer.initialize();
} else {
  throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
  caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
} else {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected void initGLCanvas() {
  GLCapabilities caps;
  if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
    caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
  } else {
    caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
  }
  caps.setHardwareAccelerated(true);
  caps.setDoubleBuffered(true);
  caps.setStencilBits(settings.getStencilBits());
  caps.setDepthBits(settings.getDepthBits());
  if (settings.getSamples() > 1) {
    caps.setSampleBuffers(true);
    caps.setNumSamples(settings.getSamples());
  }
  canvas = GLWindow.create(caps);
  canvas.invoke(false, new GLRunnable() {
    public boolean run(GLAutoDrawable glad) {
      canvas.getGL().setSwapInterval(settings.isVSync() ? 1 : 0);
      return true;
    }
  });
  canvas.requestFocus();
  canvas.setSize(settings.getWidth(), settings.getHeight());
  canvas.addGLEventListener(this);
  
  //FIXME not sure it is the best place to do that
  renderable.set(true);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected void initContextFirstTime() {
  final String renderer = settings.getRenderer();
  final GLCapabilities capabilities = createCapabilities(!renderer.equals(AppSettings.LWJGL_OPENGL2));

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (settings.getRenderer().startsWith("JOGL")) {
  com.jme3.renderer.opengl.GL gl = new JoglGL();
  GLExt glext = new JoglGLExt();
  renderer.initialize();
} else {
  throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

final String renderer = settings.getRenderer();

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * <code>setUpRendererChooser</code> sets the list of available renderers.
 * Data is obtained from the <code>DisplaySystem</code> class. The
 * renderer specified by GameSettings is used as the default value.
 * 
 * @return the list of renderers.
 */
private JComboBox setUpRendererChooser() {
  String modes[] = {"NULL", "JOGL-OpenGL1", "LWJGL-OpenGL2", "LWJGL-OpenGL3", "LWJGL-OpenGL3.1"};
  JComboBox nameBox = new JComboBox(modes);
  nameBox.setSelectedItem(source.getRenderer());
  return nameBox;
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-desktop

private JmeContext newContextCustom(AppSettings settings, JmeContext.Type type) {
  try {
    String className = settings.getRenderer().substring("CUSTOM".length());
    Class<? extends JmeContext> ctxClazz = null;
    ctxClazz = (Class<? extends JmeContext>) Class.forName(className);
    return ctxClazz.newInstance();
  } catch (InstantiationException ex) {
    logger.log(Level.SEVERE, "Failed to create context", ex);
  } catch (IllegalAccessException ex) {
    logger.log(Level.SEVERE, "Failed to create context", ex);
  } catch (ClassNotFoundException ex) {
    logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!", ex);
  }
  return null;
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-desktop

@Override
public JmeContext newContext(AppSettings settings, Type contextType) {
  initialize(settings);
  JmeContext ctx;
  if (settings.getRenderer() == null
      || settings.getRenderer().equals("NULL")
      || contextType == JmeContext.Type.Headless) {
    ctx = new NullContext();
    ctx.setSettings(settings);
  } else if (settings.getRenderer().startsWith("LWJGL")) {
    ctx = newContextLwjgl(settings, contextType);
    ctx.setSettings(settings);
  } else if (settings.getRenderer().startsWith("JOGL")) {
    ctx = newContextJogl(settings, contextType);
    ctx.setSettings(settings);
  } else if (settings.getRenderer().startsWith("CUSTOM")) {
    ctx = newContextCustom(settings, contextType);
    ctx.setSettings(settings);
  } else {
    throw new UnsupportedOperationException(
        "Unrecognizable renderer specified: "
        + settings.getRenderer());
  }
  return ctx;
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

protected ContextAttribs createContextAttribs() {
  if (settings.getBoolean("GraphicsDebug") || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
    ContextAttribs attr;
    if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
      attr = new ContextAttribs(3, 2);
      attr = attr.withProfileCore(true).withForwardCompatible(true).withProfileCompatibility(false);
    } else {
      attr = new ContextAttribs();
    }
    if (settings.getBoolean("GraphicsDebug")) {
      attr = attr.withDebug(true);
    }
    return attr;
  } else {
    return null;
  }
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
    || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
  GL gl = new LwjglGL();
  GLFbo glfbo = new LwjglGLExt();
  renderer.initialize();
} else {
  throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());

代码示例来源:origin: org.jmonkeyengine/jme3-jogl

if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
  caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
} else {

代码示例来源:origin: org.jmonkeyengine/jme3-jogl

protected void initGLCanvas() {
  GLCapabilities caps;
  if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
    caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
  } else {
    caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
  }
  caps.setHardwareAccelerated(true);
  caps.setDoubleBuffered(true);
  caps.setStencilBits(settings.getStencilBits());
  caps.setDepthBits(settings.getDepthBits());
  if (settings.getSamples() > 1) {
    caps.setSampleBuffers(true);
    caps.setNumSamples(settings.getSamples());
  }
  canvas = GLWindow.create(caps);
  canvas.invoke(false, new GLRunnable() {
    public boolean run(GLAutoDrawable glad) {
      canvas.getGL().setSwapInterval(settings.isVSync() ? 1 : 0);
      return true;
    }
  });
  canvas.requestFocus();
  canvas.setSize(settings.getWidth(), settings.getHeight());
  canvas.addGLEventListener(this);
  
  //FIXME not sure it is the best place to do that
  renderable.set(true);
}

代码示例来源:origin: org.jmonkeyengine/jme3-jogl

if (settings.getRenderer().startsWith("JOGL")) {
  com.jme3.renderer.opengl.GL gl = new JoglGL();
  GLExt glext = new JoglGLExt();
  renderer.initialize();
} else {
  throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());

相关文章

AppSettings类方法