From 99df2204c92eb06b37fba6ff75aa6b7f5e803502 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 31 Jul 2011 20:40:56 +0200 Subject: FixedFuncUtil: Name/Fix getFixedFuncImpl() -> wrapFixedFuncEmul() Fix wrapFixedFuncEmul(): - only wrap if ES2 and (!ES1 || force) - return same profile if ES1 - otherwise throw exception --- .../opengl/util/glsl/fixedfunc/FixedFuncUtil.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/com/jogamp') diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java index 9d7eecb60..c2b3308db 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java @@ -15,29 +15,31 @@ import jogamp.opengl.util.glsl.fixedfunc.*; public class FixedFuncUtil { /** * @return If gl is a GL2ES1 and force is false, return the type cast object, - * otherwise create a fixed function emulation pipeline with the GL2ES2 impl. + * otherwise create a fixed function emulation pipeline using the given GL2ES2 impl + * and hook it to the GLContext via {@link GLContext#setGL(GL)}. * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 */ - public static final GL2ES1 getFixedFuncImpl(GL gl, boolean force) { - if(!force && gl.isGL2ES1()) { - return gl.getGL2ES1(); - } else if(gl.isGL2ES2()) { + public static final GL2ES1 wrapFixedFuncEmul(GL gl, boolean force) { + if(gl.isGL2ES2() && ( !gl.isGL2ES1() || force ) ) { GL2ES2 es2 = gl.getGL2ES2(); FixedFuncHook hook = new FixedFuncHook(es2); FixedFuncImpl impl = new FixedFuncImpl(es2, hook); gl.getContext().setGL(impl); return impl; + } else if(gl.isGL2ES1()) { + return gl.getGL2ES1(); } throw new GLException("GL Object is neither GL2ES1 nor GL2ES2: "+gl.getContext()); } /** * @return If gl is a GL2ES1, return the type cast object, - * otherwise create a fixed function emulation pipeline with the GL2ES2 impl. + * otherwise create a fixed function emulation pipeline using the GL2ES2 impl. + * and hook it to the GLContext via {@link GLContext#setGL(GL)}. * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 */ - public static final GL2ES1 getFixedFuncImpl(GL gl) { - return getFixedFuncImpl(gl, false); + public static final GL2ES1 wrapFixedFuncEmul(GL gl) { + return wrapFixedFuncEmul(gl, false); } /** -- cgit v1.2.3