* Set AppSettings.setRenderer() to LWJGL_OpenGL_ANY to choose renderer based on capabilities of video card.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7385 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent cfb647f743
commit 1a3823b6aa
  1. 1
      engine/src/core/com/jme3/system/AppSettings.java
  2. 15
      engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
  3. 22
      engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglContext.java

@ -48,6 +48,7 @@ public class AppSettings extends HashMap<String, Object> {
public static final String LWJGL_OPENGL1 = "LWJGL-OPENGL1",
LWJGL_OPENGL2 = "LWJGL-OpenGL2",
LWJGL_OPENGL3 = "LWJGL-OpenGL3",
LWJGL_OPENGL_ANY = "LWJGL-OpenGL-Any",
JOGL = "JOGL",
NULL = "NULL";
public static final String LWJGL_OPENAL = "LWJGL";

@ -1,5 +1,6 @@
package com.jme3.renderer.lwjgl;
import org.lwjgl.opengl.GL14;
import com.jme3.math.FastMath;
import com.jme3.renderer.GL1Renderer;
import com.jme3.shader.Shader;
@ -518,7 +519,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
}
// Check sizes if graphics card doesn't support NPOT
// if (!GLContext.getCapabilities().GL_ARB_texture_non_power_of_two){
if (!GLContext.getCapabilities().GL_ARB_texture_non_power_of_two){
if (img.getWidth() != 0 && img.getHeight() != 0){
if (!FastMath.isPowerOfTwo(img.getWidth())
|| !FastMath.isPowerOfTwo(img.getHeight())
@ -529,14 +530,18 @@ public class LwjglGL1Renderer implements GL1Renderer {
}
}
// }
}
if (!img.hasMipmaps() && mips) {
// No pregenerated mips available,
// generate from base level if required
// glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
// TODO: Generate mipmaps here
MipMapGenerator.generateMipMaps(img);
// Check if hardware mips are supported
if (GLContext.getCapabilities().OpenGL14){
glTexParameteri(target, GL14.GL_GENERATE_MIPMAP, GL_TRUE);
}else{
MipMapGenerator.generateMipMaps(img);
}
} else {
}

@ -115,10 +115,20 @@ public abstract class LwjglContext implements JmeContext {
}
protected void initContextFirstTime(){
if (GLContext.getCapabilities().OpenGL20){
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
|| settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)){
renderer = new LwjglRenderer();
}else{
}else if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL1)){
renderer = new LwjglGL1Renderer();
}else if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL_ANY)){
// Choose an appropriate renderer based on capabilities
if (GLContext.getCapabilities().OpenGL20){
renderer = new LwjglRenderer();
}else{
renderer = new LwjglGL1Renderer();
}
}else{
throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());
}
// Init renderer
@ -154,14 +164,6 @@ public abstract class LwjglContext implements JmeContext {
public void internalCreate(){
timer = new LwjglTimer();
// if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
// || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)){
// renderer = new LwjglRenderer();
// }else if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL1)){
// renderer = new LwjglGL1Renderer();
// }else{
// throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());
// }
synchronized (createdLock){
created.set(true);
createdLock.notifyAll();

Loading…
Cancel
Save