glstuff

experiments with opengl2/ogles2/sdl
git clone http://frotz.net/git/glstuff.git
Log | Files | Refs

opengl.h (2650B)


      1 /* Copyright 2013 Brian Swetland <swetland@frotz.net>
      2  *
      3  * Licensed under the Apache License, Version 2.0 (the "License");
      4  * you may not use this file except in compliance with the License.
      5  * You may obtain a copy of the License at
      6  *
      7  *     http://www.apache.org/licenses/LICENSE-2.0
      8  *
      9  * Unless required by applicable law or agreed to in writing, software
     10  * distributed under the License is distributed on an "AS IS" BASIS,
     11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12  * See the License for the specific language governing permissions and
     13  * limitations under the License.
     14  */
     15 
     16 #ifndef _OPEN_GL_H_
     17 #define _OPEN_GL_H_
     18 
     19 #ifndef _WIN32
     20 #define GL_GLEXT_PROTOTYPES 1
     21 #endif
     22 
     23 #include <SDL_opengl.h>
     24 
     25 #ifdef _WIN32
     26 #ifndef GLUE_DEFINE_EXTENSIONS
     27 #define GLXTN extern
     28 #else
     29 #define GLXTN
     30 #endif
     31 
     32 GLXTN PFNGLACTIVETEXTUREPROC glActiveTexture;
     33 GLXTN PFNGLATTACHSHADERPROC glAttachShader;
     34 GLXTN PFNGLBINDBUFFERPROC glBindBuffer;
     35 GLXTN PFNGLBUFFERDATAPROC glBufferData;
     36 GLXTN PFNGLCOMPILESHADERPROC glCompileShader;
     37 GLXTN PFNGLCREATEPROGRAMPROC glCreateProgram;
     38 GLXTN PFNGLCREATESHADERPROC glCreateShader;
     39 GLXTN PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
     40 GLXTN PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
     41 GLXTN PFNGLGENBUFFERSPROC glGenBuffers;
     42 GLXTN PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
     43 GLXTN PFNGLGETPROGRAMIVPROC glGetProgramiv;
     44 GLXTN PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
     45 GLXTN PFNGLGETSHADERIVPROC glGetShaderiv;
     46 GLXTN PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
     47 GLXTN PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
     48 GLXTN PFNGLLINKPROGRAMPROC glLinkProgram;
     49 GLXTN PFNGLSHADERSOURCEPROC glShaderSource;
     50 GLXTN PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
     51 GLXTN PFNGLUNIFORM1IPROC glUniform1i;
     52 GLXTN PFNGLUNIFORM4FVPROC glUniform4fv;
     53 GLXTN PFNGLUSEPROGRAMPROC glUseProgram;
     54 GLXTN PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
     55 
     56 #ifdef GLUE_DEFINE_EXTENSIONS
     57 #define EFUNC(n) { (void**) &n, #n }
     58 struct {
     59 	void **func;
     60 	const char *name;
     61 } fntb[] = {
     62 	EFUNC(glActiveTexture), EFUNC(glAttachShader), EFUNC(glBindBuffer), EFUNC(glBufferData),
     63 	EFUNC(glCompileShader), EFUNC(glCreateProgram), EFUNC(glCreateShader), EFUNC(glDisableVertexAttribArray),
     64 	EFUNC(glEnableVertexAttribArray), EFUNC(glGenBuffers), EFUNC(glGetAttribLocation), EFUNC(glGetProgramiv),
     65 	EFUNC(glGetProgramInfoLog), EFUNC(glGetShaderiv), EFUNC(glGetShaderInfoLog),
     66 	EFUNC(glGetUniformLocation), EFUNC(glLinkProgram), EFUNC(glShaderSource),
     67 	EFUNC(glUniformMatrix4fv), EFUNC(glUseProgram), EFUNC(glUniform1i), EFUNC(glUniform4fv), EFUNC(glVertexAttribPointer),
     68 };
     69 #endif
     70 #endif
     71 #endif