diff options
author | Sven Gothel <[email protected]> | 2012-10-20 10:51:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-20 10:51:57 +0200 |
commit | 9ad687e18a67d335ea8ed4868025d0c740e02583 (patch) | |
tree | 0f8c79feebc5d9678ce04e6f35deb990394496cd /src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders | |
parent | 545a9422324f5c8ef47b48a2e3e5419c56f19f14 (diff) |
FFP-Emu: Adding simple POINTS shader ; Adding GLRunnable2 interface, allowing passing a GL action w/ custom argument and return value.
Adding simple POINTS shader not regarding POINTS parameters and not using a texture (commented out).
FIXME:
Event thought it works using a texture and gl_PointCoord in frag shader,
I don't see the point here (lol) if gl_PointSize must be 1.0 in vert shader ..
otherwise nothing is seen on ES2.0.
On Desktop POINTS are always shown as 1 pixel sized points!
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders')
3 files changed, 43 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/FixedFuncPoints.fp b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/FixedFuncPoints.fp new file mode 100644 index 000000000..beca47bc1 --- /dev/null +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/FixedFuncPoints.fp @@ -0,0 +1,16 @@ + +#include es_precision.glsl +#include mgl_lightdef.glsl + +#include mgl_const.glsl +#include mgl_uniform.glsl +#include mgl_varying.glsl + +void main (void) +{ + // FIXME: Since gl_Points must be 1.0 (otherwise no points) + // don't see reason for fetching texture color. + // gl_FragColor = frontColor * texture2D(mgl_Texture0, gl_PointCoord); + gl_FragColor = frontColor; +} + diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/FixedFuncPoints.vp b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/FixedFuncPoints.vp new file mode 100644 index 000000000..6d6a3a982 --- /dev/null +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/FixedFuncPoints.vp @@ -0,0 +1,25 @@ +#include es_precision.glsl + +#include mgl_const.glsl +#include mgl_uniform.glsl +#include mgl_attribute.glsl +#include mgl_varying.glsl + +#include mgl_settexcoord.vp + +void main(void) +{ + if(mgl_ColorEnabled>0) { + frontColor=mgl_Color; + } else { + frontColor=mgl_ColorStatic; + } + + // FIXME: ES2 .. doesn't work, but even on desktop + // no big points! + // gl_PointSize = mgl_PointParams1[0]; + gl_PointSize = 1.0; + + gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * vec4(mgl_Vertex.xyz, 1.0); +} + diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/mgl_uniform.glsl b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/mgl_uniform.glsl index 679583cd7..fd24a953d 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/mgl_uniform.glsl +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/shaders/mgl_uniform.glsl @@ -11,7 +11,8 @@ uniform LOWP int mgl_ColorEnabled; uniform vec4 mgl_ColorStatic; uniform LOWP int mgl_AlphaTestFunc; uniform float mgl_AlphaTestRef; -uniform float mgl_PointParams[8]; // sz, smooth, attnMinSz, attnMaxSz, attnCoeff(3), attnAlphaTs +uniform MEDIUMP float mgl_PointParams1[4]; // sz, smooth, attnMinSz, attnMaxSz +uniform MEDIUMP float mgl_PointParams2[4]; // attnCoeff(3), attnAlphaTs // uniform LOWP int mgl_CullFace; // ES2 supports CullFace implicit .. #if MAX_TEXTURE_UNITS > 0 |