aboutsummaryrefslogtreecommitdiff
path: root/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2012-01-05 21:01:19 +0100
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2012-01-05 21:01:19 +0100
commit62462d2734a16c2b355216b98089f405f6a8163f (patch)
treeb8deee3a60f18d201aa35e4f62e1f4285c673e80 /samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
parentf50ddaa63c563cf2483e9c61d22086a05cfd2115 (diff)
downloadcodesamples-62462d2734a16c2b355216b98089f405f6a8163f.tar.gz
codesamples-62462d2734a16c2b355216b98089f405f6a8163f.tar.bz2
OpenGL 3 context creation
Diffstat (limited to 'samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c')
-rw-r--r--samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
index f7fc68e..643c0ca 100644
--- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
+++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
@@ -62,7 +62,7 @@ static const GLchar *fragment_shader_source =
" vec2 mod_texcoord = gl_TexCoord[0].st*vec2(1., 2.) + vec2(0, -0.5 + 0.5*sin(T + 1.5*ts*pi));\n"
" if( mod_texcoord.t < 0. || mod_texcoord.t > 1. ) { discard; }\n"
" gl_FragColor = -texture2D(texCMYK, mod_texcoord) + texture2D(texRGB, gl_TexCoord[0].st);\n"
-" gl_FragColor.a = 1.0;\n"
+" gl_FragColor.a = -0.5;\n"
"}\n\0";
GLuint shaderFragment = 0;
@@ -245,11 +245,11 @@ static void createTheWindow()
width = DisplayWidth(Xdisplay, DefaultScreen(Xdisplay))/2;
height = DisplayHeight(Xdisplay, DefaultScreen(Xdisplay))/2;
- x=width/2, y=height/2;
+ int const dim = width < height ? width : height;
window_handle = XCreateWindow( Xdisplay,
Xroot,
- x, y, width, height,
+ 0, 0, dim, dim,
0,
visual->depth,
InputOutput,
@@ -275,11 +275,14 @@ static void createTheWindow()
textprop.format = 8;
textprop.nitems = strlen(title);
- hints.x = x;
- hints.y = y;
- hints.width = width;
- hints.height = height;
- hints.flags = USPosition|USSize;
+ hints.width = dim;
+ hints.height = dim;
+ hints.min_aspect.x = 1;
+ hints.min_aspect.y = 1;
+ hints.max_aspect.x = 1;
+ hints.max_aspect.y = 1;
+
+ hints.flags = USSize|PAspect;
startup_state = XAllocWMHints();
startup_state->initial_state = NormalState;
@@ -461,7 +464,10 @@ static void redrawTheWindow(double T)
glDisable(GL_SCISSOR_TEST);
- glClearColor(0., 0., 0., 0.0);
+#if 0
+ glClearColor(88./255., 95./255., 160./255., 0.);
+#endif
+ glClearColor(0., 0., 0., 0.);
glClearDepth(1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);