summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java20
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java24
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java14
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java26
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java178
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java34
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java12
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java2
8 files changed, 155 insertions, 155 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java
index 1f59b5805..515583b14 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java
@@ -30,20 +30,20 @@ package jogamp.graph.curve.opengl;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
-/** RegionFactory to create a Context specific Region implementation.
- *
+/** RegionFactory to create a Context specific Region implementation.
+ *
* @see GLRegion
*/
public class RegionFactory {
-
+
/**
* Create a Region using the passed render mode
- *
+ *
* <p> In case {@link Region#VBAA_RENDERING_BIT} is being requested the default texture unit
* {@link Region#TWO_PASS_DEFAULT_TEXTURE_UNIT} is being used.</p>
- *
+ *
* @param rs the RenderState to be used
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
*/
public static GLRegion create(int renderModes) {
if( 0 != ( Region.VBAA_RENDERING_BIT & renderModes ) ){
@@ -53,18 +53,18 @@ public class RegionFactory {
return new VBORegionSPES2(renderModes);
}
}
-
+
/** Create a Single Pass Region using the passed render mode
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
* {@link Region#VBAA_RENDERING_BIT}
* @return
*/
public static GLRegion createSinglePass(int renderModes) {
return new VBORegionSPES2(renderModes);
}
-
+
/** Create a Two Pass (VBAA) Region using the passed render mode
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
* {@link Region#VBAA_RENDERING_BIT}
* @return
*/
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 7f5afcd02..22600cb89 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -43,12 +43,12 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class RegionRendererImpl01 extends RegionRenderer {
public RegionRendererImpl01(RenderState rs, int renderModes) {
super(rs, renderModes);
-
+
}
-
+
protected boolean initShaderProgram(GL2ES2 gl) {
final ShaderState st = rs.getShaderState();
-
+
final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader",
"shader/bin", getVertexShaderName(), true);
final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, "shader",
@@ -57,29 +57,29 @@ public class RegionRendererImpl01 extends RegionRenderer {
// rsFp.defaultShaderCustomization(gl, true, true);
int pos = rsFp.addGLSLVersion(gl);
if( gl.isGLES2() ) {
- pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable);
+ pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable);
}
final String rsFpDefPrecision = getFragmentShaderPrecision(gl);
if( null != rsFpDefPrecision ) {
rsFp.insertShaderSource(0, pos, rsFpDefPrecision);
}
-
+
final ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
sp.add(rsFp);
- if( !sp.init(gl) ) {
+ if( !sp.init(gl) ) {
throw new GLException("RegionRenderer: Couldn't init program: "+sp);
}
- st.attachShaderProgram(gl, sp, false);
+ st.attachShaderProgram(gl, sp, false);
st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
-
+ st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
+
if(!sp.link(gl, System.err)) {
throw new GLException("RegionRenderer: Couldn't link program: "+sp);
- }
+ }
st.useProgram(gl, true);
-
+
if(DEBUG) {
System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
}
@@ -94,5 +94,5 @@ public class RegionRendererImpl01 extends RegionRenderer {
@Override
protected void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texSize) {
((GLRegion)region).draw(gl, rs, vp_width, vp_height, texSize);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
index 51356ca13..8ca29b9f0 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
@@ -38,9 +38,9 @@ import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
-public class RenderStateImpl extends RenderState {
+public class RenderStateImpl extends RenderState {
/**
- * weight is equivalent to the
+ * weight is equivalent to the
* global off-curve vertex weight.
* TODO: change to per vertex
*/
@@ -50,7 +50,7 @@ public class RenderStateImpl extends RenderState {
public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) {
super(st, pointFactory, pmvMatrix);
-
+
gcu_Weight = new GLUniformData(UniformNames.gcu_Weight, 1.0f);
st.ownUniform(gcu_PMVMatrix);
gcu_Alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f);
@@ -60,15 +60,15 @@ public class RenderStateImpl extends RenderState {
// gcu_Strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f);
// st.ownUniform(gcu_Strength);
}
-
+
public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) {
this(st, pointFactory, new PMVMatrix());
}
-
+
public final GLUniformData getWeight() { return gcu_Weight; }
public final GLUniformData getAlpha() { return gcu_Alpha; }
public final GLUniformData getColorStatic() { return gcu_ColorStatic; }
//public final GLUniformData getStrength() { return gcu_Strength; }
-
-
+
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 81c421371..60758b90b 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -40,11 +40,11 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
-public class TextRendererImpl01 extends TextRenderer {
+public class TextRendererImpl01 extends TextRenderer {
public TextRendererImpl01(RenderState rs, int type) {
- super(rs, type);
+ super(rs, type);
}
-
+
@Override
protected boolean initShaderProgram(GL2ES2 gl){
final ShaderState st = rs.getShaderState();
@@ -63,18 +63,18 @@ public class TextRendererImpl01 extends TextRenderer {
if( null != rsFpDefPrecision ) {
rsFp.insertShaderSource(0, pos, rsFpDefPrecision);
}
-
+
final ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
sp.add(rsFp);
-
- if( !sp.init(gl) ) {
+
+ if( !sp.init(gl) ) {
throw new GLException("RegionRenderer: Couldn't init program: "+sp);
}
- st.attachShaderProgram(gl, sp, false);
+ st.attachShaderProgram(gl, sp, false);
st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
-
+ st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
+
if(!sp.link(gl, System.err)) {
throw new GLException("TextRendererImpl01: Couldn't link program: "+sp);
}
@@ -82,15 +82,15 @@ public class TextRendererImpl01 extends TextRenderer {
if(DEBUG) {
System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
- }
+ }
return true;
}
-
+
@Override
protected void destroyImpl(GL2ES2 gl) {
super.destroyImpl(gl);
}
-
+
@Override
public void drawString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int[/*1*/] texSize) {
if(!isInitialized()){
@@ -101,7 +101,7 @@ public class TextRendererImpl01 extends TextRenderer {
glyphString = createString(gl, font, fontSize, str);
addCachedGlyphString(gl, font, str, fontSize, glyphString);
}
-
+
glyphString.renderString3D(gl, rs, vp_width, vp_height, texSize);
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 85d3ad5a7..86c0db8c6 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -30,7 +30,7 @@ package jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
import javax.media.opengl.GL2ES2;
-// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER !
+// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER !
import javax.media.opengl.GL;
import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
@@ -58,90 +58,90 @@ public class VBORegion2PES2 extends GLRegion {
private GLArrayDataServer verticeFboAttr;
private GLArrayDataServer texCoordFboAttr;
private GLArrayDataServer indicesFbo;
-
-
+
+
private FBObject fbo;
private TextureAttachment texA;
private PMVMatrix fboPMVMatrix;
GLUniformData mgl_fboPMVMatrix;
-
+
private int tex_width_c = 0;
private int tex_height_c = 0;
- GLUniformData mgl_ActiveTexture;
+ GLUniformData mgl_ActiveTexture;
GLUniformData mgl_TextureSize; // if GLSL < 1.30
-
+
public VBORegion2PES2(int renderModes, int textureEngine) {
super(renderModes);
fboPMVMatrix = new PMVMatrix();
- mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
- mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine);
+ mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
+ mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine);
}
-
+
public void update(GL2ES2 gl, RenderState rs) {
if(!isDirty()) {
- return;
+ return;
}
if(null == indicesFbo) {
final int initialElementCount = 256;
final ShaderState st = rs.getShaderState();
-
- indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
indicesFbo.seal(true);
-
- texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+
+ texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(texCoordFboAttr, true);
- texCoordFboAttr.putf(5); texCoordFboAttr.putf(5);
- texCoordFboAttr.putf(5); texCoordFboAttr.putf(6);
- texCoordFboAttr.putf(6); texCoordFboAttr.putf(6);
- texCoordFboAttr.putf(6); texCoordFboAttr.putf(5);
+ texCoordFboAttr.putf(5); texCoordFboAttr.putf(5);
+ texCoordFboAttr.putf(5); texCoordFboAttr.putf(6);
+ texCoordFboAttr.putf(6); texCoordFboAttr.putf(6);
+ texCoordFboAttr.putf(6); texCoordFboAttr.putf(5);
texCoordFboAttr.seal(true);
-
- verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+
+ verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(verticeFboAttr, true);
-
-
- indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
-
- verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+
+
+ indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(verticeTxtAttr, true);
-
- texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+
+ texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(texCoordTxtAttr, true);
-
+
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Create: " + this);
- }
+ }
}
// process triangles
indicesTxt.seal(gl, false);
- indicesTxt.rewind();
+ indicesTxt.rewind();
for(int i=0; i<triangles.size(); i++) {
final Triangle t = triangles.get(i);
final Vertex[] t_vertices = t.getVertices();
-
+
if(t_vertices[0].getId() == Integer.MAX_VALUE){
t_vertices[0].setId(numVertices++);
t_vertices[1].setId(numVertices++);
t_vertices[2].setId(numVertices++);
-
+
vertices.add(t_vertices[0]);
vertices.add(t_vertices[1]);
vertices.add(t_vertices[2]);
-
+
indicesTxt.puts((short) t_vertices[0].getId());
indicesTxt.puts((short) t_vertices[1].getId());
indicesTxt.puts((short) t_vertices[2].getId());
} else {
indicesTxt.puts((short) t_vertices[0].getId());
indicesTxt.puts((short) t_vertices[1].getId());
- indicesTxt.puts((short) t_vertices[2].getId());
+ indicesTxt.puts((short) t_vertices[2].getId());
}
}
indicesTxt.seal(gl, true);
@@ -157,43 +157,43 @@ public class VBORegion2PES2 extends GLRegion {
final Vertex v = vertices.get(i);
verticeTxtAttr.putf(v.getX());
verticeTxtAttr.putf(v.getY());
- verticeTxtAttr.putf(v.getZ());
- box.resize(v.getX(), v.getY(), v.getZ());
-
+ verticeTxtAttr.putf(v.getZ());
+ box.resize(v.getX(), v.getY(), v.getZ());
+
final float[] tex = v.getTexCoord();
texCoordTxtAttr.putf(tex[0]);
- texCoordTxtAttr.putf(tex[1]);
+ texCoordTxtAttr.putf(tex[1]);
}
texCoordTxtAttr.seal(gl, true);
texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.seal(gl, true);
+ verticeTxtAttr.seal(gl, true);
verticeTxtAttr.enableBuffer(gl, false);
-
+
// update all bbox related data
verticeFboAttr.seal(gl, false);
- verticeFboAttr.rewind();
- verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.seal(gl, true);
+ verticeFboAttr.rewind();
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.seal(gl, true);
verticeFboAttr.enableBuffer(gl, false);
-
+
fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
fboPMVMatrix.glLoadIdentity();
fboPMVMatrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
-
+
// push data 2 GPU ..
indicesFbo.seal(gl, true);
indicesFbo.enableBuffer(gl, false);
-
+
setDirty(false);
-
+
// the buffers were disabled, since due to real/fbo switching and other vbo usage
}
-
+
int[] maxTexSize = new int[] { -1 } ;
-
+
protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
if(vp_width <=0 || vp_height <= 0 || null==texWidth || texWidth[0] <= 0){
renderRegion(gl);
@@ -205,54 +205,54 @@ public class VBORegion2PES2 extends GLRegion {
if(texWidth[0] > maxTexSize[0]) {
texWidth[0] = maxTexSize[0]; // clip to max - write-back user value!
}
- renderRegion2FBO(gl, rs, texWidth);
+ renderRegion2FBO(gl, rs, texWidth);
}
// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
renderFBO(gl, rs, vp_width, vp_height);
}
}
-
+
private void renderFBO(GL2ES2 gl, RenderState rs, int width, int hight) {
final ShaderState st = rs.getShaderState();
-
- gl.glViewport(0, 0, width, hight);
- st.uniform(gl, mgl_ActiveTexture);
+
+ gl.glViewport(0, 0, width, hight);
+ st.uniform(gl, mgl_ActiveTexture);
gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue());
- fbo.use(gl, texA);
- verticeFboAttr.enableBuffer(gl, true);
- texCoordFboAttr.enableBuffer(gl, true);
+ fbo.use(gl, texA);
+ verticeFboAttr.enableBuffer(gl, true);
+ texCoordFboAttr.enableBuffer(gl, true);
indicesFbo.bindBuffer(gl, true); // keeps VBO binding
-
+
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- indicesFbo.bindBuffer(gl, false);
+
+ indicesFbo.bindBuffer(gl, false);
texCoordFboAttr.enableBuffer(gl, false);
- verticeFboAttr.enableBuffer(gl, false);
+ verticeFboAttr.enableBuffer(gl, false);
fbo.unuse(gl);
-
+
// setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
}
-
+
private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int[/*1*/] texWidth) {
final ShaderState st = rs.getShaderState();
-
+
if(0>=texWidth[0]) {
throw new IllegalArgumentException("texWidth must be greater than 0: "+texWidth[0]);
}
-
+
tex_width_c = texWidth[0];
tex_height_c = (int) ( ( ( tex_width_c * box.getHeight() ) / box.getWidth() ) + 0.5f );
-
+
// System.out.println("FBO Size: "+texWidth[0]+" -> "+tex_width_c+"x"+tex_height_c);
// System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5));
-
+
if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) {
fbo.reset(gl, tex_width_c, tex_height_c);
}
-
- if(null == fbo) {
+
+ if(null == fbo) {
fbo = new FBObject();
- fbo.reset(gl, tex_width_c, tex_height_c);
+ fbo.reset(gl, tex_width_c, tex_height_c);
// FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth
texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
// texA = fbo.attachTexture2D(gl, 0, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
@@ -260,18 +260,18 @@ public class VBORegion2PES2 extends GLRegion {
} else {
fbo.bind(gl);
}
-
+
//render texture
gl.glViewport(0, 0, tex_width_c, tex_height_c);
st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix
-
+
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
renderRegion(gl);
fbo.unbind(gl);
-
+
st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
-
+
// if( !gl.isGL3() ) {
// GLSL < 1.30
if(null == mgl_TextureSize) {
@@ -281,21 +281,21 @@ public class VBORegion2PES2 extends GLRegion {
texSize.put(0, (float)fbo.getWidth());
texSize.put(1, (float)fbo.getHeight());
st.uniform(gl, mgl_TextureSize);
- //}
+ //}
}
-
+
private void renderRegion(GL2ES2 gl) {
- verticeTxtAttr.enableBuffer(gl, true);
+ verticeTxtAttr.enableBuffer(gl, true);
texCoordTxtAttr.enableBuffer(gl, true);
indicesTxt.bindBuffer(gl, true); // keeps VBO binding
-
+
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- indicesTxt.bindBuffer(gl, false);
+
+ indicesTxt.bindBuffer(gl, false);
texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.enableBuffer(gl, false);
+ verticeTxtAttr.enableBuffer(gl, false);
}
-
+
public void destroy(GL2ES2 gl, RenderState rs) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
@@ -305,7 +305,7 @@ public class VBORegion2PES2 extends GLRegion {
fbo.destroy(gl);
fbo = null;
texA = null;
- }
+ }
if(null != verticeTxtAttr) {
st.ownAttribute(verticeTxtAttr, false);
verticeTxtAttr.destroy(gl);
@@ -335,6 +335,6 @@ public class VBORegion2PES2 extends GLRegion {
indicesFbo = null;
}
triangles.clear();
- vertices.clear();
- }
+ vertices.clear();
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 0cba444ad..0a867b45c 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -44,13 +44,13 @@ public class VBORegionSPES2 extends GLRegion {
private GLArrayDataServer texCoordAttr = null;
private GLArrayDataServer indices = null;
- protected VBORegionSPES2(int renderModes) {
+ protected VBORegionSPES2(int renderModes) {
super(renderModes);
}
protected void update(GL2ES2 gl, RenderState rs) {
if(!isDirty()) {
- return;
+ return;
}
if(null == indices) {
@@ -59,11 +59,11 @@ public class VBORegionSPES2 extends GLRegion {
indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(verticeAttr, true);
- texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(texCoordAttr, true);
@@ -74,7 +74,7 @@ public class VBORegionSPES2 extends GLRegion {
// process triangles
indices.seal(gl, false);
- indices.rewind();
+ indices.rewind();
for(int i=0; i<triangles.size(); i++) {
final Triangle t = triangles.get(i);
final Vertex[] t_vertices = t.getVertices();
@@ -102,7 +102,7 @@ public class VBORegionSPES2 extends GLRegion {
// process vertices and update bbox
box.reset();
- verticeAttr.seal(gl, false);
+ verticeAttr.seal(gl, false);
verticeAttr.rewind();
texCoordAttr.seal(gl, false);
texCoordAttr.rewind();
@@ -110,14 +110,14 @@ public class VBORegionSPES2 extends GLRegion {
final Vertex v = vertices.get(i);
verticeAttr.putf(v.getX());
verticeAttr.putf(v.getY());
- verticeAttr.putf(v.getZ());
+ verticeAttr.putf(v.getZ());
box.resize(v.getX(), v.getY(), v.getZ());
final float[] tex = v.getTexCoord();
texCoordAttr.putf(tex[0]);
texCoordAttr.putf(tex[1]);
}
- verticeAttr.seal(gl, true);
+ verticeAttr.seal(gl, true);
verticeAttr.enableBuffer(gl, false);
texCoordAttr.seal(gl, true);
texCoordAttr.enableBuffer(gl, false);
@@ -126,21 +126,21 @@ public class VBORegionSPES2 extends GLRegion {
}
protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
- verticeAttr.enableBuffer(gl, true);
- texCoordAttr.enableBuffer(gl, true);
+ verticeAttr.enableBuffer(gl, true);
+ texCoordAttr.enableBuffer(gl, true);
indices.bindBuffer(gl, true); // keeps VBO binding
-
+
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
+
indices.bindBuffer(gl, false);
texCoordAttr.enableBuffer(gl, false);
- verticeAttr.enableBuffer(gl, false);
- }
+ verticeAttr.enableBuffer(gl, false);
+ }
public final void destroy(GL2ES2 gl, RenderState rs) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
- }
+ }
final ShaderState st = rs.getShaderState();
if(null != verticeAttr) {
st.ownAttribute(verticeAttr, false);
@@ -156,5 +156,5 @@ public class VBORegionSPES2 extends GLRegion {
indices.destroy(gl);
indices = null;
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
index 8a109c34a..b46661778 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. 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.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community OR
@@ -20,7 +20,7 @@
* 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.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -37,9 +37,9 @@ public class AttributeNames {
*/
public static final int TEXCOORD_ATTR_IDX = 1;
public static final String TEXCOORD_ATTR_NAME = "gca_TexCoords";
-
+
/** The color index in an OGL object
*/
public static final int COLOR_ATTR_IDX = 2;
- public static final String COLOR_ATTR_NAME = "gca_Colors";
+ public static final String COLOR_ATTR_NAME = "gca_Colors";
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
index ab6e0dc6e..ce23aadac 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -3,7 +3,7 @@ package jogamp.graph.curve.opengl.shader;
public class UniformNames {
public static final String gcu_PMVMatrix = "gcu_PMVMatrix"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
public static final String gcu_ColorStatic = "gcu_ColorStatic";
- public static final String gcu_Alpha = "gcu_Alpha";
+ public static final String gcu_Alpha = "gcu_Alpha";
public static final String gcu_Weight = "gcu_Weight";
public static final String gcu_TextureUnit = "gcu_TextureUnit";
public static final String gcu_TextureSize = "gcu_TextureSize";