diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-05-17 01:22:56 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-05-17 01:22:56 +0200 |
commit | 33c2afafa0c6b936dace4b2b6203f03a89823049 (patch) | |
tree | 4124060cb020b821ced20a385f9f7db41afb79f5 | |
parent | 4aeeed5a6f88cd6d34b1b6f8584f880c9a84070a (diff) |
Added colorization to fragment shader.
-rw-r--r-- | bullet_fragment.glsl | 3 | ||||
-rw-r--r-- | main.cpp | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/bullet_fragment.glsl b/bullet_fragment.glsl index 550585b..66f53a4 100644 --- a/bullet_fragment.glsl +++ b/bullet_fragment.glsl @@ -7,5 +7,6 @@ void main() { l_uv -= l_offset; l_uv = vec2(v_tex_rot * vec4(l_uv, 0.0, 1.0)); l_uv += l_offset; - gl_FragColor = vec4(texture2D(tex, l_uv)) * gl_Color; + gl_FragColor = vec4(texture2D(tex, l_uv)); + gl_FragColor.xyz += gl_Color.xyz - gl_Color.xyz * gl_FragColor.x; } @@ -133,7 +133,7 @@ int main(int, char**) { create_bullets(); TextureSDL texture1("foo.png"); - TextureSDL texture2("foo2.png"); + TextureSDL texture2("foo4.png"); GLFragmentShader shader1("bullet_fragment.glsl"); GLVertexShader shader2("bullet_vertex.glsl"); @@ -237,7 +237,9 @@ int main(int, char**) { b.pos.y += b.direction.y * step; b.pos.z += b.direction.z * step; } - + + glColor4f(0, 1, 0, 1); + glVertex4f(b.pos.x, b.pos.y, b.direction.x, b.direction.y); //glColor3f(b.color.r, b.color.g, b.color.b); /*glTexCoord2f(0, 0); @@ -261,6 +263,8 @@ int main(int, char**) { glUseProgram(0); + glColor4f(1, 1, 1, 1); + char s[0xff]; snprintf(s, 0xff, "Bullets: %d", (int)bullets.size()); |