OpenGL Fixed function shader implementation

2019-04-09 08:41发布

问题:

Is there any wrapper which emulates the OpenGL ES 1.1 API on top of OpenGL ES 2.0? I was searching quite a bit but could not find any actual implementation.

回答1:

I'm currently investigating same question, just stumbled upon this project: https://github.com/p3/regal#readme (OpenGL portability layer for OpenGL 2.x, 3.x, 4.x, Core contexts and ES 2.0). Only going to try it myself, but after reading the article http://www.gamasutra.com/view/news/177233/Indepth_Bringing_Regal_OpenGL_to_Native_Client.php, I believe this library may be solution to the problem.



回答2:

you might like this tutorial: Recreating OpenGL's Fixed Function Pipeline using Cg. It is in CG, but that is rather similar to GLSL, with a few tweaks, one could surely turn it into a shader that would mimic fixed-function pipeline on Android.

As for the other deprecated functions, such as glVertex*(), i would advise against it (it was deprecated for a reason). If, on the other hand, one needed to port some software from ES 1 to ES 2, it should not be very hard to write a wrapper even on that.



回答3:

http://code.google.com/p/gles2-bc/

this aims to emulate ES 1.1 with ES 2.0 shaders, not used it myself but will be doing!



回答4:

Take a look at JOGL.

There are some packages about emulation the fixed pipeline from GLES 1.0 using the GLES 2.0:

package javax.media.opengl.fixedfunc;
package com.jogamp.opengl.util.glsl.fixedfunc;   
package jogamp.opengl.util.glsl.fixedfunc;

Javadoc from the jogamp.opengl.util.glsl.fixedfunc.FixedFuncImpl class;

Composable pipeline, implementing the interface javax.media.opengl.GL2ES1
Each method follows the call graph:
* call prolog jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook if available 
* call downstream javax.media.opengl.GL2ES2 if available and if no call to jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook is made 

* Interface javax.media.opengl.GL2ES1 
* Prolog jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook 
* Downstream javax.media.opengl.GL2ES2 

Sample code which installs this pipeline: 
     GL gl = drawable.setGL( new FixedFuncImpl( drawable.getGL().getGL2ES2(), new FixedFuncHook( drawable.getGL().getGL2ES2() ) ) );

Besides, take a look at "OpenGL ES 2.0 Programming Guide" (Aaftab Munshi at alli.). There are some shaders examples about emulation of GLES 1.0 FFP.