Added GL4 Interface,

Added GL_*_SHADER constants
Added Caps to the Renderer
Added required converters
experimental
michael 10 years ago
parent 0d3292c83a
commit 1949a7d831
  1. 2
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java
  2. 44
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL4.java
  3. 14
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  4. 4
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java

@ -41,7 +41,7 @@ import java.nio.IntBuffer;
public interface GL3 extends GL2 {
public static final int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A;
public static final int GL_GEOMETRY_SHADER=0x8DD9;
public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+
public void glBindVertexArray(int param1); /// GL3+
public void glGenVertexArrays(IntBuffer param1); /// GL3+

@ -0,0 +1,44 @@
/*
* Copyright (c) 2009-2014 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.renderer.opengl;
import java.nio.IntBuffer;
/**
* GL functions only available on vanilla desktop OpenGL 3.0.
*
* @author Kirill Vainer
*/
public interface GL4 extends GL3 {
public static final int GL_TESS_CONTROL_SHADER=0x8E87;
public static final int GL_TESS_EVALUATION_SHADER=0x8E88;
}

@ -183,6 +183,12 @@ public class GLRenderer implements Renderer {
caps.add(Caps.OpenGL31);
if (oglVer >= 320) {
caps.add(Caps.OpenGL32);
}if(oglVer>=330){
caps.add(Caps.OpenGL33);
caps.add(Caps.GeometryShader);
}if(oglVer>=400){
caps.add(Caps.OpenGL40);
caps.add(Caps.TesselationShader);
}
}
}
@ -199,7 +205,9 @@ public class GLRenderer implements Renderer {
// so that future OpenGL revisions wont break jme3
// fall through intentional
case 400:
caps.add(Caps.GLSL400);
case 330:
caps.add(Caps.GLSL330);
case 150:
caps.add(Caps.GLSL150);
case 140:
@ -1008,6 +1016,12 @@ public class GLRenderer implements Renderer {
return GL.GL_FRAGMENT_SHADER;
case Vertex:
return GL.GL_VERTEX_SHADER;
case Geometry:
return GL3.GL_GEOMETRY_SHADER;
case TesselationControl:
return GL4.GL_TESS_CONTROL_SHADER;
case TesselationEvaluation:
return GL4.GL_TESS_EVALUATION_SHADER;
default:
throw new UnsupportedOperationException("Unrecognized shader type.");
}

@ -9,6 +9,8 @@ import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import com.jme3.renderer.opengl.GL4;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
@ -16,7 +18,7 @@ import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
public class LwjglGL implements GL, GL2, GL3 {
public class LwjglGL implements GL, GL2, GL3,GL4 {
private static void checkLimit(Buffer buffer) {
if (buffer == null) {

Loading…
Cancel
Save