refmod_test
diff sdr.c @ 1:7e911c994ef2
should work on mac now
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 18 Feb 2016 23:21:49 +0200 |
parents | b469e6a72636 |
children |
line diff
1.1 --- a/sdr.c Thu Feb 18 23:15:43 2016 +0200 1.2 +++ b/sdr.c Thu Feb 18 23:21:49 2016 +0200 1.3 @@ -3,86 +3,19 @@ 1.4 #include <string.h> 1.5 #include <errno.h> 1.6 #include <assert.h> 1.7 +#include <GL/glew.h> 1.8 1.9 #if defined(unix) || defined(__unix__) 1.10 #include <unistd.h> 1.11 #include <sys/stat.h> 1.12 -#include <GL/glx.h> 1.13 #endif /* unix */ 1.14 1.15 -#if defined(WIN32) || defined(__WIN32__) 1.16 -#include <windows.h> 1.17 - 1.18 -#define glXGetProcAddress wglGetProcAddress 1.19 -#endif /* windows */ 1.20 - 1.21 -#define GL_GLEXT_LEGACY 1.22 -#include <GL/gl.h> 1.23 - 1.24 #include "sdr.h" 1.25 1.26 -#ifndef GL_VERSION_2_0 1.27 - 1.28 -#define GL_FRAGMENT_SHADER 0x8B30 1.29 -#define GL_VERTEX_SHADER 0x8B31 1.30 -#define GL_COMPILE_STATUS 0x8B81 1.31 -#define GL_LINK_STATUS 0x8B82 1.32 -#define GL_INFO_LOG_LENGTH 0x8B84 1.33 -#define GL_CURRENT_PROGRAM 0x8B8D 1.34 - 1.35 -typedef char GLchar; 1.36 - 1.37 -GLuint (*glCreateProgram)(void); 1.38 -GLuint (*glCreateShader)(GLenum); 1.39 -void (*glDeleteProgram)(GLuint); 1.40 -void (*glDeleteShader)(GLuint); 1.41 -void (*glCompileShader)(GLuint); 1.42 -void (*glAttachShader)(GLuint, GLuint); 1.43 -void (*glGetShaderiv)(GLuint, GLenum, GLint *); 1.44 -void (*glGetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); 1.45 -void (*glGetProgramiv)(GLuint, GLenum, GLint *); 1.46 -void (*glGetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); 1.47 -void (*glLinkProgram)(GLuint); 1.48 -void (*glShaderSource)(GLuint, GLsizei, const GLchar* *, const GLint *); 1.49 -void (*glUseProgram)(GLuint); 1.50 -GLint (*glGetUniformLocation)(GLuint, const GLchar *); 1.51 -void (*glUniform1f)(GLint, GLfloat); 1.52 -void (*glUniform2f)(GLint, GLfloat, GLfloat); 1.53 -void (*glUniform3f)(GLint, GLfloat, GLfloat, GLfloat); 1.54 -void (*glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); 1.55 -void (*glUniform1i)(GLint, GLint); 1.56 -void (*glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat *); 1.57 -GLint (*glGetAttribLocation)(GLuint, const GLchar *); 1.58 -void (*glVertexAttrib3f)(GLint, GLfloat, GLfloat, GLfloat); 1.59 - 1.60 void init_sdr(void) 1.61 { 1.62 - glCreateProgram = glXGetProcAddress("glCreateProgramObjectARB"); 1.63 - glCreateShader = glXGetProcAddress("glCreateShaderObjectARB"); 1.64 - glDeleteProgram = glXGetProcAddress("glDeleteObjectARB"); 1.65 - glDeleteShader = glXGetProcAddress("glDeleteObjectARB"); 1.66 - glCompileShader = glXGetProcAddress("glCompileShaderARB"); 1.67 - glAttachShader = glXGetProcAddress("glAttachObjectARB"); 1.68 - glGetShaderiv = glXGetProcAddress("glGetObjectParameterivARB"); 1.69 - glGetShaderInfoLog = glXGetProcAddress("glGetInfoLogARB"); 1.70 - glGetProgramiv = glXGetProcAddress("glGetObjectParameterivARB"); 1.71 - glGetProgramInfoLog = glXGetProcAddress("glGetInfoLogARB"); 1.72 - glLinkProgram = glXGetProcAddress("glLinkProgramARB"); 1.73 - glShaderSource = glXGetProcAddress("glShaderSourceARB"); 1.74 - glUseProgram = glXGetProcAddress("glUseProgramObjectARB"); 1.75 - glGetUniformLocation = glXGetProcAddress("glGetUniformLocationARB"); 1.76 - glUniform1f = glXGetProcAddress("glUniform1fARB"); 1.77 - glUniform2f = glXGetProcAddress("glUniform2fARB"); 1.78 - glUniform3f = glXGetProcAddress("glUniform3fARB"); 1.79 - glUniform4f = glXGetProcAddress("glUniform4fARB"); 1.80 - glUniform1i = glXGetProcAddress("glUniform1iARB"); 1.81 - glUniformMatrix4fv = glXGetProcAddress("glUniformMatrix4fvARB"); 1.82 - glGetAttribLocation = glXGetProcAddress("glGetAttribLocationARB"); 1.83 - glVertexAttrib3f = glXGetProcAddress("glVertexAttrib3fARB"); 1.84 + glewInit(); 1.85 } 1.86 -#else 1.87 -void init_sdr(void) {} 1.88 -#endif 1.89 1.90 unsigned int create_vertex_shader(const char *src) 1.91 {