From 1e1b408ba1527edc2ee5ceede92816ee87e4c461 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 15 Feb 2014 23:28:25 +0100 Subject: Graph: RendereState: Create own PMVMatrix if passed value is null; Renderer: Add reshapeNotify(..) for NOP PMV reshape notification --- src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java | 6 +++--- src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph') 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 6a8fb6a67..9b0f32ef6 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -42,7 +42,7 @@ public abstract class RenderState { private static final String thisKey = "jogamp.graph.curve.RenderState" ; public static RenderState createRenderState(ShaderState st, Vertex.Factory pointFactory) { - return new RenderStateImpl(st, pointFactory); + return new RenderStateImpl(st, pointFactory, null); } public static RenderState createRenderState(ShaderState st, Vertex.Factory pointFactory, PMVMatrix pmvMatrix) { @@ -61,8 +61,8 @@ public abstract class RenderState { protected RenderState(ShaderState st, Vertex.Factory vertexFactory, PMVMatrix pmvMatrix) { this.st = st; this.vertexFactory = vertexFactory; - this.pmvMatrix = pmvMatrix; - this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf()); + this.pmvMatrix = null != pmvMatrix ? pmvMatrix : new PMVMatrix(); + this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, this.pmvMatrix.glGetPMvMatrixf()); st.ownUniform(gcu_PMVMatrix); } 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 8783906c2..029286601 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java @@ -241,6 +241,14 @@ public abstract class Renderer { } } + /** No PMVMatrix operation is performed here. PMVMatrix will be updated if gl is not null. */ + public boolean reshapeNotify(GL2ES2 gl, int width, int height) { + this.vp_width = width; + this.vp_height = height; + updateMatrix(gl); + return true; + } + public boolean reshapePerspective(GL2ES2 gl, float angle, int width, int height, float near, float far) { this.vp_width = width; this.vp_height = height; -- cgit v1.2.3