progs/util: remove extfuncs.h (we use GLEW instead)
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/glut.h>
|
#include <GL/glut.h>
|
||||||
#include "extfuncs.h"
|
|
||||||
#include "shaderutil.h"
|
#include "shaderutil.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +19,6 @@ Init(void)
|
|||||||
{
|
{
|
||||||
static GLboolean firstCall = GL_TRUE;
|
static GLboolean firstCall = GL_TRUE;
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
GetExtensionFuncs();
|
|
||||||
firstCall = GL_FALSE;
|
firstCall = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,14 +49,14 @@ CompileShaderText(GLenum shaderType, const char *text)
|
|||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
shader = glCreateShader_func(shaderType);
|
shader = glCreateShader(shaderType);
|
||||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
|
||||||
glCompileShader_func(shader);
|
glCompileShader(shader);
|
||||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
|
||||||
if (!stat) {
|
if (!stat) {
|
||||||
GLchar log[1000];
|
GLchar log[1000];
|
||||||
GLsizei len;
|
GLsizei len;
|
||||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||||
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
|
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -110,24 +108,24 @@ CompileShaderFile(GLenum shaderType, const char *filename)
|
|||||||
GLuint
|
GLuint
|
||||||
LinkShaders(GLuint vertShader, GLuint fragShader)
|
LinkShaders(GLuint vertShader, GLuint fragShader)
|
||||||
{
|
{
|
||||||
GLuint program = glCreateProgram_func();
|
GLuint program = glCreateProgram();
|
||||||
|
|
||||||
assert(vertShader || fragShader);
|
assert(vertShader || fragShader);
|
||||||
|
|
||||||
if (fragShader)
|
if (fragShader)
|
||||||
glAttachShader_func(program, fragShader);
|
glAttachShader(program, fragShader);
|
||||||
if (vertShader)
|
if (vertShader)
|
||||||
glAttachShader_func(program, vertShader);
|
glAttachShader(program, vertShader);
|
||||||
glLinkProgram_func(program);
|
glLinkProgram(program);
|
||||||
|
|
||||||
/* check link */
|
/* check link */
|
||||||
{
|
{
|
||||||
GLint stat;
|
GLint stat;
|
||||||
glGetProgramiv_func(program, GL_LINK_STATUS, &stat);
|
glGetProgramiv(program, GL_LINK_STATUS, &stat);
|
||||||
if (!stat) {
|
if (!stat) {
|
||||||
GLchar log[1000];
|
GLchar log[1000];
|
||||||
GLsizei len;
|
GLsizei len;
|
||||||
glGetProgramInfoLog_func(program, 1000, &len, log);
|
glGetProgramInfoLog(program, 1000, &len, log);
|
||||||
fprintf(stderr, "Shader link error:\n%s\n", log);
|
fprintf(stderr, "Shader link error:\n%s\n", log);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -144,7 +142,7 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
|
|||||||
|
|
||||||
for (i = 0; uniforms[i].name; i++) {
|
for (i = 0; uniforms[i].name; i++) {
|
||||||
uniforms[i].location
|
uniforms[i].location
|
||||||
= glGetUniformLocation_func(program, uniforms[i].name);
|
= glGetUniformLocation(program, uniforms[i].name);
|
||||||
|
|
||||||
printf("Uniform %s location: %d\n", uniforms[i].name,
|
printf("Uniform %s location: %d\n", uniforms[i].name,
|
||||||
uniforms[i].location);
|
uniforms[i].location);
|
||||||
@@ -152,19 +150,19 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
|
|||||||
switch (uniforms[i].size) {
|
switch (uniforms[i].size) {
|
||||||
case 1:
|
case 1:
|
||||||
if (uniforms[i].type == GL_INT)
|
if (uniforms[i].type == GL_INT)
|
||||||
glUniform1i_func(uniforms[i].location,
|
glUniform1i(uniforms[i].location,
|
||||||
(GLint) uniforms[i].value[0]);
|
(GLint) uniforms[i].value[0]);
|
||||||
else
|
else
|
||||||
glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
|
glUniform1fv(uniforms[i].location, 1, uniforms[i].value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
|
glUniform2fv(uniforms[i].location, 1, uniforms[i].value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
|
glUniform3fv(uniforms[i].location, 1, uniforms[i].value);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
|
glUniform4fv(uniforms[i].location, 1, uniforms[i].value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
|
Reference in New Issue
Block a user