Two changes:

1. GL_DST_ALPHA and GL_ONE_MINUS_DST_ALPHA were moved from GL3 to GL.
2. I reverted to the previous switch/case statements in
GLRenderer.convertBlendFunc(BlendFunc).
native-compilation-test
Michael Braunstingl 8 years ago
parent ca17bd592a
commit 67881b1e01
  1. 41
      jme3-core/src/main/java/com/jme3/material/RenderState.java
  2. 2
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java
  3. 2
      jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java
  4. 37
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

@ -205,7 +205,6 @@ public class RenderState implements Cloneable, Savable {
Max
}
/**
* <code>BlendFunc</code> defines the blending functions for use with
* <code>BlendMode.Custom</code>.
@ -216,67 +215,49 @@ public class RenderState implements Cloneable, Savable {
/**
* RGB Factor (0, 0, 0), Alpha Factor (0)
*/
Zero(0),
Zero,
/**
* RGB Factor (1, 1, 1), Alpha Factor (1)
*/
One(1),
One,
/**
* RGB Factor (R_s0, G_s0, B_s0), Alpha Factor (A_s0)
*/
Src_Color(2),
Src_Color,
/**
* RGB Factor (1-R_s0, 1-G_s0, 1-B_s0), Alpha Factor (1-A_s0)
*/
One_Minus_Src_Color(3),
One_Minus_Src_Color,
/**
* RGB Factor (R_d, G_d, B_d), Alpha Factor (A_d)
*/
Dst_Color(4),
Dst_Color,
/**
* RGB Factor (1-R_d, 1-G_d, 1-B_d), Alpha Factor (1-A_d)
*/
One_Minus_Dst_Color(5),
One_Minus_Dst_Color,
/**
* RGB Factor (A_s0, A_s0, A_s0), Alpha Factor (A_s0)
*/
Src_Alpha(6),
Src_Alpha,
/**
* RGB Factor (1-A_s0, 1-A_s0, 1-A_s0), Alpha Factor (1-A_s0)
*/
One_Minus_Src_Alpha(7),
One_Minus_Src_Alpha,
/**
* RGB Factor (A_d, A_d, A_d), Alpha Factor (A_d)
*/
Dst_Alpha(8),
Dst_Alpha,
/**
* RGB Factor (1-A_d, 1-A_d, 1-A_d), Alpha Factor (1-A_d)
*/
One_Minus_Dst_Alpha(9),
One_Minus_Dst_Alpha,
/**
* RGB Factor (i, i, i), Alpha Factor (1)
*/
Src_Alpha_Saturate(10);
// Convenience value for easy use by the renderer.
private final int value;
// Convenience constructor.
private BlendFunc(int value) {
this.value=value;
}
/**
* Provides a predefined integer value for easy use by the renderer.
*
* @return The predefined integer value.
*/
public int getIntValue() {
return value;
}
Src_Alpha_Saturate;
}
/**
* <code>BlendMode</code> specifies the blending operation to use.
*

@ -62,6 +62,7 @@ public interface GL {
public static final int GL_DEPTH_COMPONENT16 = 0x81A5;
public static final int GL_DEPTH_TEST = 0xB71;
public static final int GL_DOUBLE = 0x140A;
public static final int GL_DST_ALPHA = 0x0304;
public static final int GL_DST_COLOR = 0x306;
public static final int GL_DYNAMIC_DRAW = 0x88E8;
public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
@ -118,6 +119,7 @@ public interface GL {
public static final int GL_NONE = 0x0;
public static final int GL_NOTEQUAL = 0x205;
public static final int GL_ONE = 0x1;
public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305;
public static final int GL_ONE_MINUS_DST_COLOR = 0x307;
public static final int GL_ONE_MINUS_SRC_ALPHA = 0x303;
public static final int GL_ONE_MINUS_SRC_COLOR = 0x301;

@ -41,9 +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_DST_ALPHA = 0x0304;
public static final int GL_GEOMETRY_SHADER = 0x8DD9;
public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305;
public static final int GL_NUM_EXTENSIONS = 0x821D;
public static final int GL_R8 = 0x8229;
public static final int GL_R16F = 0x822D;

@ -751,10 +751,10 @@ public final class GLRenderer implements Renderer {
break;
case Custom:
gl.glBlendFuncSeparate(
state.getCustomSfactorRGB().getIntValue(),
state.getCustomDfactorRGB().getIntValue(),
state.getCustomSfactorAlpha().getIntValue(),
state.getCustomDfactorAlpha().getIntValue());
convertBlendFunc(state.getCustomSfactorRGB()),
convertBlendFunc(state.getCustomDfactorRGB()),
convertBlendFunc(state.getCustomSfactorAlpha()),
convertBlendFunc(state.getCustomDfactorAlpha()));
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
@ -857,6 +857,35 @@ public final class GLRenderer implements Renderer {
throw new UnsupportedOperationException("Unrecognized alpha blend operation: " + blendEquationAlpha);
}
}
private int convertBlendFunc(BlendFunc blendFunc) {
switch (blendFunc) {
case Zero:
return GL.GL_ZERO;
case One:
return GL.GL_ONE;
case Src_Color:
return GL.GL_SRC_COLOR;
case One_Minus_Src_Color:
return GL.GL_ONE_MINUS_SRC_COLOR;
case Dst_Color:
return GL.GL_DST_COLOR;
case One_Minus_Dst_Color:
return GL.GL_ONE_MINUS_DST_COLOR;
case Src_Alpha:
return GL.GL_SRC_ALPHA;
case One_Minus_Src_Alpha:
return GL.GL_ONE_MINUS_SRC_ALPHA;
case Dst_Alpha:
return GL.GL_DST_ALPHA;
case One_Minus_Dst_Alpha:
return GL.GL_ONE_MINUS_DST_ALPHA;
case Src_Alpha_Saturate:
return GL.GL_SRC_ALPHA_SATURATE;
default:
throw new UnsupportedOperationException("Unrecognized blend function operation: " + blendFunc);
}
}
private int convertStencilOperation(StencilOperation stencilOp) {
switch (stencilOp) {

Loading…
Cancel
Save