aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/Region.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java15
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java47
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java6
5 files changed, 36 insertions, 36 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index a759546ba..eb88b787c 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -117,7 +117,7 @@ public interface Region {
/** Delete and clean the associated OGL
* objects
*/
- public void destroy(GL2ES2 gl);
+ public void destroy(GL2ES2 gl, RenderState rs);
public AABBox getBounds();
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 2b4c8b7c5..69fdd5c4a 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -79,7 +79,7 @@ public abstract class RegionRenderer extends Renderer {
Iterator<Region> iterator = regions.values().iterator();
while(iterator.hasNext()){
Region region = iterator.next();
- region.destroy(gl);
+ region.destroy(gl, rs);
}
regions.clear();
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 6450f9f8b..84323f6e5 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -27,29 +27,28 @@
*/
package com.jogamp.graph.curve.opengl;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLProfile;
+import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLUniformData;
-import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.VersionUtil;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
public interface RenderState {
+ void destroy(GL2ES2 gl);
+
ShaderState getShaderState();
Vertex.Factory<? extends Vertex> getPointFactory();
- PMVMatrix getPMVMatrix();
- GLUniformData getPMVMatrixUniform();
+ PMVMatrix pmvMatrix();
+ GLUniformData getPMVMatrix();
GLUniformData getSharpness();
GLUniformData getAlpha();
GLUniformData getColorStatic();
GLUniformData getStrength();
- RenderState attachTo(GL gl);
- boolean detachFrom(GL gl);
+ RenderState attachTo(GL2ES2 gl);
+ boolean detachFrom(GL2ES2 gl);
StringBuilder toString(StringBuilder sb);
String toString();
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
index 4db917fdd..35022f769 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -63,7 +63,7 @@ public abstract class Renderer {
/**
* Flushes all cached data
- * @see #dispose(GL2ES2)
+ * @see #destroy(GL2ES2)
*/
public abstract void flushCache(GL2ES2 gl);
@@ -130,58 +130,59 @@ public abstract class Renderer {
rs.attachTo(gl);
gl.glEnable(GL2ES2.GL_BLEND);
- gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
+ gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA); // FIXME: alpha blending stage ?
initialized = initShaderProgram(gl);
if(!initialized) {
return false;
}
- if(!rs.getShaderState().glUniform(gl, rs.getPMVMatrixUniform())) {
+ if(!rs.getShaderState().uniform(gl, rs.getPMVMatrix())) {
if(DEBUG){
System.err.println("Error setting PMVMatrix in shader: "+rs.getShaderState());
}
return false;
}
- if(!rs.getShaderState().glUniform(gl, rs.getSharpness())) {
+ if(!rs.getShaderState().uniform(gl, rs.getSharpness())) {
if(DEBUG){
System.err.println("Error setting sharpness in shader: "+rs.getShaderState());
}
return false;
}
- if(!rs.getShaderState().glUniform(gl, rs.getAlpha())) {
+ if(!rs.getShaderState().uniform(gl, rs.getAlpha())) {
if(DEBUG){
System.err.println("Error setting global alpha in shader: "+rs.getShaderState());
}
return false;
}
- if(!rs.getShaderState().glUniform(gl, rs.getColorStatic())) {
+ if(!rs.getShaderState().uniform(gl, rs.getColorStatic())) {
if(DEBUG){
System.err.println("Error setting global color in shader: "+rs.getShaderState());
}
return false;
}
- if(!rs.getShaderState().glUniform(gl, rs.getStrength())) {
+ if(!rs.getShaderState().uniform(gl, rs.getStrength())) {
System.err.println("Error setting antialias strength in shader: "+rs.getShaderState());
}
return initialized;
}
- public void dispose(GL2ES2 gl) {
+ public void destroy(GL2ES2 gl) {
if(!initialized){
if(DEBUG_INSTANCE) {
System.err.println("TextRenderer: Not initialized!");
}
return;
}
+ rs.getShaderState().useProgram(gl, false);
flushCache(gl);
disposeImpl(gl);
- rs.getShaderState().destroy(gl);
+ rs.destroy(gl);
initialized = false;
}
@@ -189,7 +190,7 @@ public abstract class Renderer {
public final ShaderState getShaderState() { return rs.getShaderState(); }
public final void enable(GL2ES2 gl, boolean enable) {
- rs.getShaderState().glUseProgram(gl, enable);
+ rs.getShaderState().useProgram(gl, enable);
}
public float getSharpness() {
@@ -199,7 +200,7 @@ public abstract class Renderer {
public void setSharpness(GL2ES2 gl, float v) {
rs.getSharpness().setData(v);
if(null != gl && rs.getShaderState().inUse()) {
- rs.getShaderState().glUniform(gl, rs.getSharpness());
+ rs.getShaderState().uniform(gl, rs.getSharpness());
}
}
@@ -210,7 +211,7 @@ public abstract class Renderer {
public void setStrength(GL2ES2 gl, float v) {
rs.getStrength().setData(v);
if(null != gl && rs.getShaderState().inUse()) {
- rs.getShaderState().glUniform(gl, rs.getStrength());
+ rs.getShaderState().uniform(gl, rs.getStrength());
}
}
@@ -221,7 +222,7 @@ public abstract class Renderer {
public void setAlpha(GL2ES2 gl, float alpha_t) {
rs.getAlpha().setData(alpha_t);
if(null != gl && rs.getShaderState().inUse()) {
- rs.getShaderState().glUniform(gl, rs.getAlpha());
+ rs.getShaderState().uniform(gl, rs.getAlpha());
}
}
@@ -239,36 +240,36 @@ public abstract class Renderer {
fb.put(1, g);
fb.put(2, b);
if(null != gl && rs.getShaderState().inUse()) {
- rs.getShaderState().glUniform(gl, rs.getColorStatic());
+ rs.getShaderState().uniform(gl, rs.getColorStatic());
}
}
- public final PMVMatrix getMatrix() { return rs.getPMVMatrix(); }
+ public final PMVMatrix getMatrix() { return rs.pmvMatrix(); }
public void rotate(GL2ES2 gl, float angle, float x, float y, float z) {
- rs.getPMVMatrix().glRotatef(angle, x, y, z);
+ rs.pmvMatrix().glRotatef(angle, x, y, z);
updateMatrix(gl);
}
public void translate(GL2ES2 gl, float x, float y, float z) {
- rs.getPMVMatrix().glTranslatef(x, y, z);
+ rs.pmvMatrix().glTranslatef(x, y, z);
updateMatrix(gl);
}
public void scale(GL2ES2 gl, float x, float y, float z) {
- rs.getPMVMatrix().glScalef(x, y, z);
+ rs.pmvMatrix().glScalef(x, y, z);
updateMatrix(gl);
}
public void resetModelview(GL2ES2 gl) {
- rs.getPMVMatrix().glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- rs.getPMVMatrix().glLoadIdentity();
+ rs.pmvMatrix().glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ rs.pmvMatrix().glLoadIdentity();
updateMatrix(gl);
}
public void updateMatrix(GL2ES2 gl) {
if(initialized && null != gl && rs.getShaderState().inUse()) {
- rs.getShaderState().glUniform(gl, rs.getPMVMatrixUniform());
+ rs.getShaderState().uniform(gl, rs.getPMVMatrix());
}
}
@@ -276,7 +277,7 @@ public abstract class Renderer {
this.vp_width = width;
this.vp_height = height;
final float ratio = (float)width/(float)height;
- final PMVMatrix p = rs.getPMVMatrix();
+ final PMVMatrix p = rs.pmvMatrix();
p.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
p.glLoadIdentity();
p.gluPerspective(angle, ratio, near, far);
@@ -287,7 +288,7 @@ public abstract class Renderer {
public boolean reshapeOrtho(GL2ES2 gl, int width, int height, float near, float far) {
this.vp_width = width;
this.vp_height = height;
- final PMVMatrix p = rs.getPMVMatrix();
+ final PMVMatrix p = rs.pmvMatrix();
p.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
p.glLoadIdentity();
p.glOrthof(0, width, 0, height, near, far);
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
index a955d5a88..deaa1dfad 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
@@ -96,7 +96,7 @@ public abstract class TextRenderer extends Renderer {
Iterator<GlyphString> iterator = stringCacheMap.values().iterator();
while(iterator.hasNext()){
GlyphString glyphString = iterator.next();
- glyphString.destroy(gl);
+ glyphString.destroy(gl, rs);
}
stringCacheMap.clear();
stringCacheArray.clear();
@@ -167,7 +167,7 @@ public abstract class TextRenderer extends Renderer {
final String key = getKey(font, str, fontSize);
GlyphString glyphString = stringCacheMap.remove(key);
if(null != glyphString) {
- glyphString.destroy(gl);
+ glyphString.destroy(gl, rs);
}
stringCacheArray.remove(key);
}
@@ -176,7 +176,7 @@ public abstract class TextRenderer extends Renderer {
final String key = stringCacheArray.remove(idx);
final GlyphString glyphString = stringCacheMap.remove(key);
if(null != glyphString) {
- glyphString.destroy(gl);
+ glyphString.destroy(gl, rs);
}
}