| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 *length = sb.st_size; | 44 *length = sb.st_size; |
| 45 | 45 |
| 46 return mmap_ptr; | 46 return mmap_ptr; |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 static void print_info_log(int obj) | 50 static void print_info_log(int obj) |
| 51 { | 51 { |
| 52 char info_log[4096]; | 52 char info_log[4096]; |
| 53 int length; | 53 int length; |
| 54 glGetInfoLogARB(obj, sizeof(info_log)-1, &length, info_log); | 54 glGetError(); |
| 55 glGetShaderInfoLog(obj, sizeof(info_log)-1, &length, info_log); |
| 56 if (glGetError() != 0) |
| 57 glGetProgramInfoLog(obj, sizeof(info_log)-1, &length, info_log); |
| 55 char *p = info_log; | 58 char *p = info_log; |
| 56 while (p < info_log + length) { | 59 while (p < info_log + length) { |
| 57 char *newline = strchr(p, '\n'); | 60 char *newline = strchr(p, '\n'); |
| 58 if (newline) | 61 if (newline) |
| 59 *newline = '\0'; | 62 *newline = '\0'; |
| 60 printf("# Log: %s\n", p); | 63 printf("# Log: %s\n", p); |
| 61 if (!newline) | 64 if (!newline) |
| 62 break; | 65 break; |
| 63 p = newline + 1; | 66 p = newline + 1; |
| 64 } | 67 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 82 glAttachShader(program, fragment_shader); | 85 glAttachShader(program, fragment_shader); |
| 83 glLinkProgram(program); | 86 glLinkProgram(program); |
| 84 print_info_log(program); | 87 print_info_log(program); |
| 85 glUseProgram(program); | 88 glUseProgram(program); |
| 86 | 89 |
| 87 glDeleteShader(vertex_shader); | 90 glDeleteShader(vertex_shader); |
| 88 glDeleteShader(fragment_shader); | 91 glDeleteShader(fragment_shader); |
| 89 | 92 |
| 90 return program; | 93 return program; |
| 91 } | 94 } |
| OLD | NEW |