#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>
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);}";
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);