aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-18 11:02:21 +0200
committerSven Gothel <[email protected]>2012-10-18 11:02:21 +0200
commit4f1af320cc6b77fca8aa149da790004a53704474 (patch)
tree92c4e687aa8de7158635d26ca15b730f2020e27a /src
parentfa34dd97a9e89b24ee2da9e7c4ad14f8f7c25ac9 (diff)
JoglGL2ES1: Regard 'hasPointExt' (diff ImmModeSink w/ more elements and ubytes for particle sim), use new ImmModeSink value conversion.
Diffstat (limited to 'src')
-rw-r--r--src/jake2/render/fast/Main.java1
-rw-r--r--src/jake2/render/opengl/JoglES1Driver.java2
-rw-r--r--src/jake2/render/opengl/JoglES2Driver.java2
-rw-r--r--src/jake2/render/opengl/JoglGL2Driver.java2
-rw-r--r--src/jake2/render/opengl/JoglGL2ES1.java48
5 files changed, 34 insertions, 21 deletions
diff --git a/src/jake2/render/fast/Main.java b/src/jake2/render/fast/Main.java
index f63d41e..fee4267 100644
--- a/src/jake2/render/fast/Main.java
+++ b/src/jake2/render/fast/Main.java
@@ -514,7 +514,6 @@ public abstract class Main extends Base {
* R_DrawParticles
*/
void R_DrawParticles() {
-
if (gl_ext_pointparameters.value != 0.0f && qglPointParameterfEXT) {
//gl.gl.glEnableClientState(GL_VERTEX_ARRAY);
diff --git a/src/jake2/render/opengl/JoglES1Driver.java b/src/jake2/render/opengl/JoglES1Driver.java
index b1d882d..be3a9fd 100644
--- a/src/jake2/render/opengl/JoglES1Driver.java
+++ b/src/jake2/render/opengl/JoglES1Driver.java
@@ -42,7 +42,7 @@ public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver {
protected static GLProfile glp = GLProfile.get(GLProfile.GL2ES1); // exception if n/a is desired
protected JoglES1Driver() {
- // singleton
+ super(true);
}
private NEWTWin newtWin = null;
diff --git a/src/jake2/render/opengl/JoglES2Driver.java b/src/jake2/render/opengl/JoglES2Driver.java
index 5fa1f39..edfe8b2 100644
--- a/src/jake2/render/opengl/JoglES2Driver.java
+++ b/src/jake2/render/opengl/JoglES2Driver.java
@@ -47,7 +47,7 @@ public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver {
protected static final ShaderSelectionMode shaderSelectionMode = ShaderSelectionMode.COLOR_TEXTURE2;
protected JoglES2Driver() {
- // singleton
+ super(false);
}
private NEWTWin newtWin = null;
diff --git a/src/jake2/render/opengl/JoglGL2Driver.java b/src/jake2/render/opengl/JoglGL2Driver.java
index 0f91542..2dd5710 100644
--- a/src/jake2/render/opengl/JoglGL2Driver.java
+++ b/src/jake2/render/opengl/JoglGL2Driver.java
@@ -41,7 +41,7 @@ public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver {
protected static GLProfile glp = GLProfile.get(GLProfile.GL2); // exception if n/a is desired
protected JoglGL2Driver() {
- // singleton
+ super(true);
}
private NEWTWin newtWin = null;
diff --git a/src/jake2/render/opengl/JoglGL2ES1.java b/src/jake2/render/opengl/JoglGL2ES1.java
index 94c0c45..1e438ab 100644
--- a/src/jake2/render/opengl/JoglGL2ES1.java
+++ b/src/jake2/render/opengl/JoglGL2ES1.java
@@ -9,22 +9,32 @@ import com.jogamp.opengl.util.ImmModeSink;
public class JoglGL2ES1 implements QGL {
+ private final boolean hasPointExt;
private GL2ES1 gl;
- protected final ImmModeSink ims;
+ protected ImmModeSink ims;
private boolean inBlock = false; // within begin/end
- JoglGL2ES1() {
- // singleton
- ims = ImmModeSink.createFixed(4,
- 3, GL.GL_FLOAT, // vertex
- 0, 0, // color
- 0, 0, // normal
- 2, GL.GL_FLOAT, // texture
- GL.GL_STATIC_DRAW);
+ JoglGL2ES1(boolean hasPointExt) {
+ this.hasPointExt = hasPointExt;
}
void setGL(GL2ES1 gl) {
this.gl = gl;
+ if(hasPointExt) {
+ ims = ImmModeSink.createFixed(4,
+ 3, GL.GL_FLOAT, // vertex
+ 0, 0, // color
+ 0, 0, // normal
+ 2, GL.GL_FLOAT, // texture
+ GL.GL_STATIC_DRAW);
+ } else {
+ ims = ImmModeSink.createFixed(6000,
+ 3, GL.GL_FLOAT, // vertex
+ 4, GL.GL_UNSIGNED_BYTE, // color (for particle simulation)
+ 0, 0, // normal
+ 2, GL.GL_FLOAT, // texture
+ GL.GL_STATIC_DRAW);
+ }
}
public void glBegin(int mode) {
@@ -48,9 +58,13 @@ public class JoglGL2ES1 implements QGL {
}
public void glColor3ub(byte red, byte green, byte blue) {
- glColor4ub(red, green, blue, (byte) 255);
+ if(inBlock) {
+ ims.glColor3ub(red, green, blue);
+ } else {
+ gl.glColor4ub(red, green, blue, (byte)255);
+ }
}
-
+
public void glColor4f(float red, float green, float blue, float alpha) {
if(inBlock) {
ims.glColor4f(red, green, blue, alpha);
@@ -60,11 +74,11 @@ public class JoglGL2ES1 implements QGL {
}
public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
- final float r = (red & 255) / 255.0f;
- final float g = (green & 255) / 255.0f;
- final float b = (blue & 255) / 255.0f;
- final float a = (alpha & 255) / 255.0f;
- glColor4f(r, g, b, a);
+ if(inBlock) {
+ ims.glColor4ub(red, green, blue, alpha);
+ } else {
+ gl.glColor4ub(red, green, blue, alpha);
+ }
}
public void glTexCoord2f(float s, float t) {
@@ -227,7 +241,7 @@ public class JoglGL2ES1 implements QGL {
StringBuilder sb = new StringBuilder();
sb.append(gl.glGetString(name));
sb.append(" GL_ARB_multitexture");
- if( gl.isGLES1() ) {
+ if(hasPointExt) {
sb.append(" GL_EXT_point_parameters");
}
return sb.toString();