FIxed a few shaders varyings, problem identified on MAC to be solved

This commit is contained in:
samcake 2015-08-03 11:18:08 -07:00
parent 785fd03085
commit d3fc05e99f
9 changed files with 56 additions and 56 deletions

View file

@ -11,13 +11,13 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
uniform sampler2D colorMap;
uniform vec4 color;
in vec2 varTexcoord;
in vec2 varTexCoord0;
out vec4 outFragColor;
void main(void) {
outFragColor = texture(colorMap, varTexcoord) * color;
outFragColor = texture(colorMap, varTexCoord0) * color;
}

View file

@ -13,27 +13,27 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
<@include gpu/Transform.slh@>
<@include gpu/Transform.slh@>
<$declareStandardTransform()$>
uniform vec4 texcoordRect;
out vec2 varTexcoord;
out vec2 varTexCoord0;
void main(void) {
const vec4 UNIT_QUAD[4] = vec4[4](
vec4(-1.0, -1.0, 0.0, 1.0),
vec4(1.0, -1.0, 0.0, 1.0),
vec4(-1.0, 1.0, 0.0, 1.0),
const vec4 UNIT_QUAD[4] = vec4[4](
vec4(-1.0, -1.0, 0.0, 1.0),
vec4(1.0, -1.0, 0.0, 1.0),
vec4(-1.0, 1.0, 0.0, 1.0),
vec4(1.0, 1.0, 0.0, 1.0)
);
vec4 pos = UNIT_QUAD[gl_VertexID];
// standard transform
TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
varTexcoord = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy;
// standard transform
TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
varTexCoord0 = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy;
}

View file

@ -11,12 +11,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
uniform sampler2D colorMap;
in vec2 varTexcoord;
in vec2 varTexCoord0;
out vec4 outFragColor;
void main(void) {
outFragColor = texture(colorMap, varTexcoord);
outFragColor = texture(colorMap, varTexCoord0);
}

View file

@ -12,12 +12,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
uniform sampler2D colorMap;
in vec2 varTexcoord;
in vec2 varTexCoord0;
out vec4 outFragColor;
void main(void) {
outFragColor = vec4(texture(colorMap, varTexcoord).xyz, 1.0);
outFragColor = vec4(texture(colorMap, varTexCoord0).xyz, 1.0);
}

View file

@ -12,25 +12,25 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
<@include gpu/Transform.slh@>
<@include gpu/Transform.slh@>
<$declareStandardTransform()$>
out vec2 varTexcoord;
out vec2 varTexCoord0;
void main(void) {
const vec4 UNIT_QUAD[4] = vec4[4](
vec4(-1.0, -1.0, 0.0, 1.0),
vec4(1.0, -1.0, 0.0, 1.0),
vec4(-1.0, 1.0, 0.0, 1.0),
const vec4 UNIT_QUAD[4] = vec4[4](
vec4(-1.0, -1.0, 0.0, 1.0),
vec4(1.0, -1.0, 0.0, 1.0),
vec4(-1.0, 1.0, 0.0, 1.0),
vec4(1.0, 1.0, 0.0, 1.0)
);
vec4 pos = UNIT_QUAD[gl_VertexID];
// standard transform
TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
varTexcoord = (pos.xy + 1) * 0.5;
// standard transform
TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
varTexCoord0 = (pos.xy + 1) * 0.5;
}

View file

@ -16,7 +16,7 @@
<$declareStandardTransform()$>
out vec2 varTexcoord;
out vec2 varTexCoord0;
void main(void) {
const vec4 UNIT_QUAD[4] = vec4[4](
@ -34,5 +34,5 @@ void main(void) {
<$transformModelToWorldPos(obj, tc, tc)$>
gl_Position = pos;
varTexcoord = tc.xy;
varTexCoord0 = tc.xy;
}

View file

@ -19,8 +19,8 @@ uniform sampler2D originalTexture;
// the interpolated normal
in vec3 _normal;
in vec4 _texCoord0;
in vec4 _color;
in vec3 _color;
in vec2 _texCoord0;
void main(void) {
vec4 texel = texture(originalTexture, _texCoord0.st);

View file

@ -14,18 +14,18 @@
// the texture
uniform sampler2D colorMap;
in vec3 _position;
in vec3 _normal;
in vec2 _texCoord0;
in vec4 _color;
in vec3 varPosition;
in vec3 varNormal;
in vec2 varTexCoord0;
in vec4 varColor;
out vec4 _fragColor;
out vec4 outFragColor;
void main(void) {
vec4 color = texture(colorMap, _texCoord0);
vec4 color = texture(colorMap, varTexCoord0);
// FIXME CORE this isn't working
//_fragColor = color * _color;
//_fragColor = vec4(color.rgb, color.a * _color.a);
//_fragColor = vec4(color.rgb * _color.rgb, color.a);
_fragColor = color;
outFragColor = color;
}

View file

@ -18,19 +18,19 @@
<$declareStandardTransform()$>
out vec3 _position;
out vec3 _normal;
out vec2 _texCoord0;
out vec4 _color;
out vec3 varPosition;
out vec3 varNormal;
out vec2 varTexCoord0;
out vec4 varColor;
void main(void) {
_texCoord0 = inTexCoord0.st;
_color = inColor;
varTexCoord0 = inTexCoord0.st;
varColor = inColor;
// standard transform
TransformCamera cam = getTransformCamera();
TransformObject obj = getTransformObject();
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
<$transformModelToEyeDir(cam, obj, inNormal.xyz, _normal)$>
_position = inPosition.xyz;
<$transformModelToEyeDir(cam, obj, inNormal.xyz, varNormal)$>
varPosition = inPosition.xyz;
}