-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
135 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#version 120 | ||
|
||
varying vec4 color; | ||
varying vec2 texCoord; | ||
|
||
uniform sampler2D galaxyTex; | ||
|
||
void main(void) | ||
{ | ||
gl_FragColor = texture2D(galaxyTex, texCoord) * color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#version 120 | ||
|
||
uniform sampler2D colorTex; | ||
|
||
varying vec4 color; | ||
varying vec2 texCoord; | ||
|
||
void main(void) | ||
{ | ||
// we pass color index as short int | ||
// reusing gl_MultiTexCoord0.z | ||
// we use 255 only because we have 256 color indices | ||
float t = gl_MultiTexCoord0.z / 255.0f; // [0, 255] -> [0, 1] | ||
// we pass alpha values as as short int | ||
// reusing gl_MultiTexCoord0.w | ||
// we use 65535 for better precision | ||
float a = gl_MultiTexCoord0.w / 65535.0f; // [0, 65535] -> [0, 1] | ||
color = vec4(texture2D(colorTex, vec2(t, 0.0f)).rgb, a); | ||
texCoord = gl_MultiTexCoord0.st; | ||
gl_Position = ftransform(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters