diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2010-06-25 18:58:24 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2010-06-25 18:58:24 -0400 |
commit | 67a21bdf56765c15316077ab36a3a280828e606e (patch) | |
tree | 4c8080676d939d3d663d728eb73f57b258d8a8b5 | |
parent | 2d6b7c118b2af194a370fd1bf5c264499f1e37cc (diff) |
Fix indentation
-rw-r--r-- | compositor.c | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/compositor.c b/compositor.c index 6b31b48..268c8e5 100644 --- a/compositor.c +++ b/compositor.c @@ -804,81 +804,81 @@ static const char fragment_shader[] = static int init_shaders(struct wlsc_compositor *ec) { - GLuint v, f, program; - const char *p; - char msg[512]; - GLfloat vertices[4 * 5]; - GLint status; - - p = vertex_shader; - v = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(v, 1, &p, NULL); - glCompileShader(v); - glGetShaderiv(v, GL_COMPILE_STATUS, &status); - if (!status) { - glGetShaderInfoLog(v, sizeof msg, NULL, msg); - fprintf(stderr, "vertex shader info: %s\n", msg); - return -1; - } - - p = fragment_shader; - f = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(f, 1, &p, NULL); - glCompileShader(f); - glGetShaderiv(f, GL_COMPILE_STATUS, &status); - if (!status) { - glGetShaderInfoLog(f, sizeof msg, NULL, msg); - fprintf(stderr, "fragment shader info: %s\n", msg); - return -1; - } - - program = glCreateProgram(); - glAttachShader(program, v); - glAttachShader(program, f); - glBindAttribLocation(program, 0, "position"); - glBindAttribLocation(program, 1, "texcoord"); - - glLinkProgram(program); - glGetProgramiv(program, GL_LINK_STATUS, &status); - if (!status) { - glGetProgramInfoLog(program, sizeof msg, NULL, msg); - fprintf(stderr, "link info: %s\n", msg); - return -1; - } - - glUseProgram(program); - ec->proj_uniform = glGetUniformLocation(program, "proj"); - ec->tex_uniform = glGetUniformLocation(program, "tex"); - - vertices[ 0] = 0.0; - vertices[ 1] = 0.0; - vertices[ 2] = 0.0; - vertices[ 3] = 0.0; - vertices[ 4] = 0.0; - - vertices[ 5] = 0.0; - vertices[ 6] = 1.0; - vertices[ 7] = 0.0; - vertices[ 8] = 0.0; - vertices[ 9] = 1.0; - - vertices[10] = 1.0; - vertices[11] = 0.0; - vertices[12] = 0.0; - vertices[13] = 1.0; - vertices[14] = 0.0; - - vertices[15] = 1.0; - vertices[16] = 1.0; - vertices[17] = 0.0; - vertices[18] = 1.0; - vertices[19] = 1.0; - - glGenBuffers(1, &ec->vbo); - glBindBuffer(GL_ARRAY_BUFFER, ec->vbo); - glBufferData(GL_ARRAY_BUFFER, sizeof vertices, vertices, GL_STATIC_DRAW); - - return 0; + GLuint v, f, program; + const char *p; + char msg[512]; + GLfloat vertices[4 * 5]; + GLint status; + + p = vertex_shader; + v = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(v, 1, &p, NULL); + glCompileShader(v); + glGetShaderiv(v, GL_COMPILE_STATUS, &status); + if (!status) { + glGetShaderInfoLog(v, sizeof msg, NULL, msg); + fprintf(stderr, "vertex shader info: %s\n", msg); + return -1; + } + + p = fragment_shader; + f = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(f, 1, &p, NULL); + glCompileShader(f); + glGetShaderiv(f, GL_COMPILE_STATUS, &status); + if (!status) { + glGetShaderInfoLog(f, sizeof msg, NULL, msg); + fprintf(stderr, "fragment shader info: %s\n", msg); + return -1; + } + + program = glCreateProgram(); + glAttachShader(program, v); + glAttachShader(program, f); + glBindAttribLocation(program, 0, "position"); + glBindAttribLocation(program, 1, "texcoord"); + + glLinkProgram(program); + glGetProgramiv(program, GL_LINK_STATUS, &status); + if (!status) { + glGetProgramInfoLog(program, sizeof msg, NULL, msg); + fprintf(stderr, "link info: %s\n", msg); + return -1; + } + + glUseProgram(program); + ec->proj_uniform = glGetUniformLocation(program, "proj"); + ec->tex_uniform = glGetUniformLocation(program, "tex"); + + vertices[ 0] = 0.0; + vertices[ 1] = 0.0; + vertices[ 2] = 0.0; + vertices[ 3] = 0.0; + vertices[ 4] = 0.0; + + vertices[ 5] = 0.0; + vertices[ 6] = 1.0; + vertices[ 7] = 0.0; + vertices[ 8] = 0.0; + vertices[ 9] = 1.0; + + vertices[10] = 1.0; + vertices[11] = 0.0; + vertices[12] = 0.0; + vertices[13] = 1.0; + vertices[14] = 0.0; + + vertices[15] = 1.0; + vertices[16] = 1.0; + vertices[17] = 0.0; + vertices[18] = 1.0; + vertices[19] = 1.0; + + glGenBuffers(1, &ec->vbo); + glBindBuffer(GL_ARRAY_BUFFER, ec->vbo); + glBufferData(GL_ARRAY_BUFFER, sizeof vertices, vertices, GL_STATIC_DRAW); + + return 0; } static const struct wl_interface visual_interface = { |