Un poco de limpieza
authorslack <slack@codemaniacs.com>
Mon, 7 Dec 2009 00:21:33 +0000 (01:21 +0100)
committerslack <slack@codemaniacs.com>
Mon, 7 Dec 2009 00:21:33 +0000 (01:21 +0100)
main.c

diff --git a/main.c b/main.c
index 20877c6e9ab89182850b2cc7f1c547a832482143..d1689674b8026c43aecf35876af09ca7ae7a326a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,4 +1,8 @@
 #include <SDL.h>
+#define GL_GLEXT_PROTOTYPES
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <GL/glext.h>
 #include <math.h>
 #include <stdlib.h>
 
@@ -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);