Attempt to fixing 1074 (#1093)
* Attempt to fixing 1074 * Added method implementations in GlRenderer * Added test. * Added test to jme-examples * Some changes to resolve merge conficts * Fixes * Indent-fixes * Documented the class and added stop() * Fixed a minor error * Fixed build gradles * Removed line ending
This commit is contained in:
parent
b0db8923d1
commit
dc4b71ce2b
@ -429,4 +429,17 @@ public interface Renderer {
|
|||||||
*/
|
*/
|
||||||
public boolean isTaskResultAvailable(int taskId);
|
public boolean isTaskResultAvailable(int taskId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the alpha to coverage state.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public boolean getAlphaToCoverage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default anisotropic filter level for textures.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public int getDefaultAnisotropicFilter();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2917,4 +2917,17 @@ public final class GLRenderer implements Renderer {
|
|||||||
public boolean isTaskResultAvailable(int taskId) {
|
public boolean isTaskResultAvailable(int taskId) {
|
||||||
return gl.glGetQueryObjectiv(taskId, GL.GL_QUERY_RESULT_AVAILABLE) == 1;
|
return gl.glGetQueryObjectiv(taskId, GL.GL_QUERY_RESULT_AVAILABLE) == 1;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public boolean getAlphaToCoverage() {
|
||||||
|
if (caps.contains(Caps.Multisample)) {
|
||||||
|
return gl.glIsEnabled(GLExt.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultAnisotropicFilter() {
|
||||||
|
return this.defaultAnisotropicFilter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,4 +203,14 @@ public class NullRenderer implements Renderer {
|
|||||||
@Override
|
@Override
|
||||||
public void setDefaultAnisotropicFilter(int level) {
|
public void setDefaultAnisotropicFilter(int level) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getAlphaToCoverage() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultAnisotropicFilter() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package jme3test.renderer;
|
||||||
|
import com.jme3.app.SimpleApplication;
|
||||||
|
|
||||||
|
import com.jme3.renderer.lwjgl.LwjglGL;
|
||||||
|
import com.jme3.renderer.opengl.GL;
|
||||||
|
import com.jme3.renderer.opengl.GLExt;
|
||||||
|
import com.jme3.renderer.opengl.GLFbo;
|
||||||
|
import com.jme3.renderer.opengl.GLRenderer;
|
||||||
|
import com.jme3.renderer.lwjgl.LwjglGLExt;
|
||||||
|
import com.jme3.renderer.lwjgl.LwjglGLFboEXT;
|
||||||
|
import com.jme3.renderer.Caps;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple application to test the getter and setters of AlphaToCoverage and
|
||||||
|
* DefaultAnisotropicFilter from the GLRenderer class.
|
||||||
|
*
|
||||||
|
* Since the app doesn't display anything relevant a stop() has been added
|
||||||
|
* This starts and closes the app on a successful run
|
||||||
|
*/
|
||||||
|
public class TestAlphaToCoverage extends SimpleApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new TestAlphaToCoverage().start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GL gl = new LwjglGL();
|
||||||
|
public GLExt glext = new LwjglGLExt();
|
||||||
|
public GLFbo glfbo = new LwjglGLFboEXT();
|
||||||
|
private GLRenderer glRenderer= new GLRenderer(gl,glext,glfbo);
|
||||||
|
|
||||||
|
public EnumSet<Caps> caps = glRenderer.getCaps();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleInitApp() {
|
||||||
|
glRenderer.setAlphaToCoverage(false);
|
||||||
|
assert !glRenderer.getAlphaToCoverage();
|
||||||
|
|
||||||
|
caps.add(Caps.Multisample);
|
||||||
|
glRenderer.setAlphaToCoverage(true);
|
||||||
|
assert glRenderer.getAlphaToCoverage();
|
||||||
|
glRenderer.setAlphaToCoverage(false);
|
||||||
|
assert !glRenderer.getAlphaToCoverage();
|
||||||
|
|
||||||
|
glRenderer.setDefaultAnisotropicFilter(1);
|
||||||
|
assert glRenderer.getDefaultAnisotropicFilter() == 1;
|
||||||
|
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user