From dbf84f49c4509e7cd9acb9998e9962e4decff0f0 Mon Sep 17 00:00:00 2001 From: slack Date: Mon, 7 Dec 2009 01:21:33 +0100 Subject: [PATCH] Un poco de limpieza --- main.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/main.c b/main.c index 20877c6..d168967 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,8 @@ #include +#define GL_GLEXT_PROTOTYPES +#include +#include +#include #include #include @@ -192,24 +196,24 @@ void main(void){\ uv = (vec2( gl_Position.x, - gl_Position.y ) + vec2( 1.0 ) ) / vec2( 2.0 );}"; -const GLchar *fsh="uniform sampler2D tex;\ -varying vec2 uv;\ -const float sampleDist = 1.0;\ -const float sampleStrength = 2.2;\ -void main(void){\ - float samples[10] = float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);\ -vec2 dir = 0.5 - uv;\ -float dist = sqrt(dir.x*dir.x + dir.y*dir.y);\ - dir = dir/dist;\ - vec4 color = texture2D(tex,uv);\ - vec4 sum = color;\ - for (int i = 0;\ i < 5;\ i++){\ - sum += texture2D( tex, uv + dir * samples[i] * sampleDist );\ - }\ - sum *= 1.0/11.0;\ - float t = dist * sampleStrength;\ - t = clamp( t ,0.0,1.0);\ - gl_FragColor = mix( color, sum, t );}"; +const GLchar *fsh="uniform sampler2D tex;" +"varying vec2 uv;" +"const float sampleDist = 1.0;" +"const float sampleStrength = 2.2;" +"void main(void){" + "float samples[10] = float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);" + "vec2 dir = 0.5 - uv;" + "float dist = sqrt(dir.x*dir.x + dir.y*dir.y);" + "dir = dir/dist;" + "vec4 color = texture2D(tex,uv);" + "vec4 sum = color;" + "for (int i=0;i<5;i++){" + "sum += texture2D( tex, uv + dir * samples[i] * sampleDist );" + "}" + "sum *= 1.0/11.0;" + "float t = dist * sampleStrength;" + "t = clamp( t ,0.0,1.0);" + "gl_FragColor = mix(color,sum,t);}"; @@ -238,7 +242,7 @@ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); void initShaders() { - printf("%x", fn.glCreateShader); + printf("%p", fn.glCreateShader); GLint e= fn.glGetError(); printf("\n%i\n",e); GLuint v =fn.glCreateShader(GL_VERTEX_SHADER); -- 2.34.1