fg_gl2: Use GLES2 functions directly
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1253 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
41c8a0c66b
commit
77d621e304
@ -38,6 +38,7 @@ void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fgInitGL2() {
|
void fgInitGL2() {
|
||||||
|
#ifndef GL_ES_VERSION_2_0
|
||||||
fgState.HasOpenGL20 = 0;
|
fgState.HasOpenGL20 = 0;
|
||||||
// TODO: Mesa returns a valid stub function, rather than NULL,
|
// TODO: Mesa returns a valid stub function, rather than NULL,
|
||||||
// when we request a non-existent function
|
// when we request a non-existent function
|
||||||
@ -50,5 +51,6 @@ void fgInitGL2() {
|
|||||||
CHECK("fghEnableVertexAttribArray", fghEnableVertexAttribArray = (FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC)glutGetProcAddress("glEnableVertexAttribArray"));
|
CHECK("fghEnableVertexAttribArray", fghEnableVertexAttribArray = (FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC)glutGetProcAddress("glEnableVertexAttribArray"));
|
||||||
CHECK("fghDisableVertexAttribArray", fghDisableVertexAttribArray = (FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC)glutGetProcAddress("glDisableVertexAttribArray"));
|
CHECK("fghDisableVertexAttribArray", fghDisableVertexAttribArray = (FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC)glutGetProcAddress("glDisableVertexAttribArray"));
|
||||||
#undef CHECK
|
#undef CHECK
|
||||||
|
#endif
|
||||||
fgState.HasOpenGL20 = 1;
|
fgState.HasOpenGL20 = 1;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,28 @@
|
|||||||
#ifndef FG_GL2_H
|
#ifndef FG_GL2_H
|
||||||
#define FG_GL2_H
|
#define FG_GL2_H
|
||||||
|
|
||||||
|
#include <GL/freeglut.h>
|
||||||
|
#include "fg_internal.h"
|
||||||
|
|
||||||
|
#ifdef GL_ES_VERSION_2_0
|
||||||
|
/* Use existing functions on GLES 2.0 */
|
||||||
|
|
||||||
|
#define FGH_ARRAY_BUFFER GL_ARRAY_BUFFER
|
||||||
|
#define FGH_STATIC_DRAW GL_STATIC_DRAW
|
||||||
|
#define FGH_ELEMENT_ARRAY_BUFFER GL_ELEMENT_ARRAY_BUFFER
|
||||||
|
|
||||||
|
#define fghGenBuffers glGenBuffers
|
||||||
|
#define fghDeleteBuffers glDeleteBuffers
|
||||||
|
#define fghBindBuffer glBindBuffer
|
||||||
|
#define fghBufferData glBufferData
|
||||||
|
#define fghEnableVertexAttribArray glEnableVertexAttribArray
|
||||||
|
#define fghDisableVertexAttribArray glDisableVertexAttribArray
|
||||||
|
#define fghVertexAttribPointer glVertexAttribPointer
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* Load functions dynamically, they are not defined in e.g. win32's
|
||||||
|
OpenGL headers */
|
||||||
|
|
||||||
# ifndef APIENTRY
|
# ifndef APIENTRY
|
||||||
# define APIENTRY
|
# define APIENTRY
|
||||||
# endif
|
# endif
|
||||||
@ -54,3 +76,5 @@ FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
|
|||||||
FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
|
FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user