* clutter/cogl/gl/cogl-defines.h.in:

Defined GL extension functions used by Cogl inside the COGL_
	namespace.

	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gl/cogl.c:
	Use COGL_ extension function prototypes instead of relying
	on glext.h to define them. Should fix the mac compilability
	bug, but haven't tested it yet.
This commit is contained in:
Ivan Leben 2008-05-12 17:20:22 +00:00
parent b9827fb945
commit 3a3712d924
3 changed files with 184 additions and 46 deletions

View File

@ -61,30 +61,30 @@ typedef struct
GArray *program_handles;
/* Relying on glext.h to define these */
PFNGLGENRENDERBUFFERSEXTPROC pf_glGenRenderbuffersEXT;
PFNGLBINDRENDERBUFFEREXTPROC pf_glBindRenderbufferEXT;
PFNGLRENDERBUFFERSTORAGEEXTPROC pf_glRenderbufferStorageEXT;
PFNGLGENFRAMEBUFFERSEXTPROC pf_glGenFramebuffersEXT;
PFNGLBINDFRAMEBUFFEREXTPROC pf_glBindFramebufferEXT;
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC pf_glFramebufferTexture2DEXT;
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pf_glFramebufferRenderbufferEXT;
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC pf_glCheckFramebufferStatusEXT;
PFNGLDELETEFRAMEBUFFERSEXTPROC pf_glDeleteFramebuffersEXT;
PFNGLBLITFRAMEBUFFEREXTPROC pf_glBlitFramebufferEXT;
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC pf_glRenderbufferStorageMultisampleEXT;
COGL_PFNGLGENRENDERBUFFERSEXTPROC pf_glGenRenderbuffersEXT;
COGL_PFNGLBINDRENDERBUFFEREXTPROC pf_glBindRenderbufferEXT;
COGL_PFNGLRENDERBUFFERSTORAGEEXTPROC pf_glRenderbufferStorageEXT;
COGL_PFNGLGENFRAMEBUFFERSEXTPROC pf_glGenFramebuffersEXT;
COGL_PFNGLBINDFRAMEBUFFEREXTPROC pf_glBindFramebufferEXT;
COGL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC pf_glFramebufferTexture2DEXT;
COGL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pf_glFramebufferRenderbufferEXT;
COGL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC pf_glCheckFramebufferStatusEXT;
COGL_PFNGLDELETEFRAMEBUFFERSEXTPROC pf_glDeleteFramebuffersEXT;
COGL_PFNGLBLITFRAMEBUFFEREXTPROC pf_glBlitFramebufferEXT;
COGL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC pf_glRenderbufferStorageMultisampleEXT;
PFNGLCREATEPROGRAMOBJECTARBPROC pf_glCreateProgramObjectARB;
PFNGLCREATESHADEROBJECTARBPROC pf_glCreateShaderObjectARB;
PFNGLSHADERSOURCEARBPROC pf_glShaderSourceARB;
PFNGLCOMPILESHADERARBPROC pf_glCompileShaderARB;
PFNGLATTACHOBJECTARBPROC pf_glAttachObjectARB;
PFNGLLINKPROGRAMARBPROC pf_glLinkProgramARB;
PFNGLUSEPROGRAMOBJECTARBPROC pf_glUseProgramObjectARB;
PFNGLGETUNIFORMLOCATIONARBPROC pf_glGetUniformLocationARB;
PFNGLDELETEOBJECTARBPROC pf_glDeleteObjectARB;
PFNGLGETINFOLOGARBPROC pf_glGetInfoLogARB;
PFNGLGETOBJECTPARAMETERIVARBPROC pf_glGetObjectParameterivARB;
PFNGLUNIFORM1FARBPROC pf_glUniform1fARB;
COGL_PFNGLCREATEPROGRAMOBJECTARBPROC pf_glCreateProgramObjectARB;
COGL_PFNGLCREATESHADEROBJECTARBPROC pf_glCreateShaderObjectARB;
COGL_PFNGLSHADERSOURCEARBPROC pf_glShaderSourceARB;
COGL_PFNGLCOMPILESHADERARBPROC pf_glCompileShaderARB;
COGL_PFNGLATTACHOBJECTARBPROC pf_glAttachObjectARB;
COGL_PFNGLLINKPROGRAMARBPROC pf_glLinkProgramARB;
COGL_PFNGLUSEPROGRAMOBJECTARBPROC pf_glUseProgramObjectARB;
COGL_PFNGLGETUNIFORMLOCATIONARBPROC pf_glGetUniformLocationARB;
COGL_PFNGLDELETEOBJECTARBPROC pf_glDeleteObjectARB;
COGL_PFNGLGETINFOLOGARBPROC pf_glGetInfoLogARB;
COGL_PFNGLGETOBJECTPARAMETERIVARBPROC pf_glGetObjectParameterivARB;
COGL_PFNGLUNIFORM1FARBPROC pf_glUniform1fARB;
} CoglContext;

View File

@ -705,6 +705,144 @@ typedef GLuint COGLuint;
#define CLUTTER_COGL_HAS_GL 1
/* Extension function prototypes */
typedef void
(APIENTRYP COGL_PFNGLGENRENDERBUFFERSEXTPROC)
(GLsizei n,
GLuint *renderbuffers);
typedef void
(APIENTRYP COGL_PFNGLBINDRENDERBUFFEREXTPROC)
(GLenum target,
GLuint renderbuffer);
typedef void
(APIENTRYP COGL_PFNGLRENDERBUFFERSTORAGEEXTPROC)
(GLenum target,
GLenum internalformat,
GLsizei width,
GLsizei height);
typedef void
(APIENTRYP COGL_PFNGLGENFRAMEBUFFERSEXTPROC)
(GLsizei n,
GLuint *framebuffers);
typedef void
(APIENTRYP COGL_PFNGLBINDFRAMEBUFFEREXTPROC)
(GLenum target,
GLuint framebuffer);
typedef void
(APIENTRYP COGL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
(GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level);
typedef void
(APIENTRYP COGL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
(GLenum target,
GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer);
typedef GLenum
(APIENTRYP COGL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
(GLenum target);
typedef void
(APIENTRYP COGL_PFNGLDELETEFRAMEBUFFERSEXTPROC)
(GLsizei n,
const GLuint *framebuffers);
typedef void
(APIENTRYP COGL_PFNGLDELETERENDERBUFFERSEXTPROC)
(GLsizei n,
const GLuint *renderbuffers);
typedef void
(APIENTRYP COGL_PFNGLBLITFRAMEBUFFEREXTPROC)
(GLint srcX0,
GLint srcY0,
GLint srcX1,
GLint srcY1,
GLint dstX0,
GLint dstY0,
GLint dstX1,
GLint dstY1,
GLbitfield mask,
GLenum filter);
typedef void
(APIENTRYP COGL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)
(GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height);
typedef GLhandleARB
(APIENTRYP COGL_PFNGLCREATEPROGRAMOBJECTARBPROC)
(void);
typedef GLhandleARB
(APIENTRYP COGL_PFNGLCREATESHADEROBJECTARBPROC)
(GLenum shaderType);
typedef void
(APIENTRYP COGL_PFNGLSHADERSOURCEARBPROC)
(GLhandleARB shaderObj,
GLsizei count,
const GLcharARB* *string,
const GLint *length);
typedef void
(APIENTRYP COGL_PFNGLCOMPILESHADERARBPROC)
(GLhandleARB shaderObj);
typedef void
(APIENTRYP COGL_PFNGLATTACHOBJECTARBPROC)
(GLhandleARB containerObj,
GLhandleARB obj);
typedef void
(APIENTRYP COGL_PFNGLLINKPROGRAMARBPROC)
(GLhandleARB programObj);
typedef void
(APIENTRYP COGL_PFNGLUSEPROGRAMOBJECTARBPROC)
(GLhandleARB programObj);
typedef GLint
(APIENTRYP COGL_PFNGLGETUNIFORMLOCATIONARBPROC)
(GLhandleARB programObj,
const GLcharARB *name);
typedef void
(APIENTRYP COGL_PFNGLDELETEOBJECTARBPROC)
(GLhandleARB obj);
typedef void
(APIENTRYP COGL_PFNGLGETINFOLOGARBPROC)
(GLhandleARB obj,
GLsizei maxLength,
GLsizei *length,
GLcharARB *infoLog);
typedef void
(APIENTRYP COGL_PFNGLGETOBJECTPARAMETERIVARBPROC)
(GLhandleARB obj,
GLenum pname,
GLint *params);
typedef void
(APIENTRYP COGL_PFNGLUNIFORM1FARBPROC)
(GLint location,
GLfloat v0);
G_END_DECLS
#endif

View File

@ -630,51 +630,51 @@ _cogl_features_init ()
cogl_check_extension ("GL_ARB_fragment_shader", gl_extensions))
{
ctx->pf_glCreateProgramObjectARB =
(PFNGLCREATEPROGRAMOBJECTARBPROC)
(COGL_PFNGLCREATEPROGRAMOBJECTARBPROC)
cogl_get_proc_address ("glCreateProgramObjectARB");
ctx->pf_glCreateShaderObjectARB =
(PFNGLCREATESHADEROBJECTARBPROC)
(COGL_PFNGLCREATESHADEROBJECTARBPROC)
cogl_get_proc_address ("glCreateShaderObjectARB");
ctx->pf_glShaderSourceARB =
(PFNGLSHADERSOURCEARBPROC)
(COGL_PFNGLSHADERSOURCEARBPROC)
cogl_get_proc_address ("glShaderSourceARB");
ctx->pf_glCompileShaderARB =
(PFNGLCOMPILESHADERARBPROC)
(COGL_PFNGLCOMPILESHADERARBPROC)
cogl_get_proc_address ("glCompileShaderARB");
ctx->pf_glAttachObjectARB =
(PFNGLATTACHOBJECTARBPROC)
(COGL_PFNGLATTACHOBJECTARBPROC)
cogl_get_proc_address ("glAttachObjectARB");
ctx->pf_glLinkProgramARB =
(PFNGLLINKPROGRAMARBPROC)
(COGL_PFNGLLINKPROGRAMARBPROC)
cogl_get_proc_address ("glLinkProgramARB");
ctx->pf_glUseProgramObjectARB =
(PFNGLUSEPROGRAMOBJECTARBPROC)
(COGL_PFNGLUSEPROGRAMOBJECTARBPROC)
cogl_get_proc_address ("glUseProgramObjectARB");
ctx->pf_glGetUniformLocationARB =
(PFNGLGETUNIFORMLOCATIONARBPROC)
(COGL_PFNGLGETUNIFORMLOCATIONARBPROC)
cogl_get_proc_address ("glGetUniformLocationARB");
ctx->pf_glDeleteObjectARB =
(PFNGLDELETEOBJECTARBPROC)
(COGL_PFNGLDELETEOBJECTARBPROC)
cogl_get_proc_address ("glDeleteObjectARB");
ctx->pf_glGetInfoLogARB =
(PFNGLGETINFOLOGARBPROC)
(COGL_PFNGLGETINFOLOGARBPROC)
cogl_get_proc_address ("glGetInfoLogARB");
ctx->pf_glGetObjectParameterivARB =
(PFNGLGETOBJECTPARAMETERIVARBPROC)
(COGL_PFNGLGETOBJECTPARAMETERIVARBPROC)
cogl_get_proc_address ("glGetObjectParameterivARB");
ctx->pf_glUniform1fARB =
(PFNGLUNIFORM1FARBPROC)
(COGL_PFNGLUNIFORM1FARBPROC)
cogl_get_proc_address ("glUniform1fARB");
if (ctx->pf_glCreateProgramObjectARB &&
@ -697,39 +697,39 @@ _cogl_features_init ()
cogl_check_extension ("GL_ARB_framebuffer_object", gl_extensions))
{
ctx->pf_glGenRenderbuffersEXT =
(PFNGLGENRENDERBUFFERSEXTPROC)
(COGL_PFNGLGENRENDERBUFFERSEXTPROC)
cogl_get_proc_address ("glGenRenderbuffersEXT");
ctx->pf_glBindRenderbufferEXT =
(PFNGLBINDRENDERBUFFEREXTPROC)
(COGL_PFNGLBINDRENDERBUFFEREXTPROC)
cogl_get_proc_address ("glBindRenderbufferEXT");
ctx->pf_glRenderbufferStorageEXT =
(PFNGLRENDERBUFFERSTORAGEEXTPROC)
(COGL_PFNGLRENDERBUFFERSTORAGEEXTPROC)
cogl_get_proc_address ("glRenderbufferStorageEXT");
ctx->pf_glGenFramebuffersEXT =
(PFNGLGENFRAMEBUFFERSEXTPROC)
(COGL_PFNGLGENFRAMEBUFFERSEXTPROC)
cogl_get_proc_address ("glGenFramebuffersEXT");
ctx->pf_glBindFramebufferEXT =
(PFNGLBINDFRAMEBUFFEREXTPROC)
(COGL_PFNGLBINDFRAMEBUFFEREXTPROC)
cogl_get_proc_address ("glBindFramebufferEXT");
ctx->pf_glFramebufferTexture2DEXT =
(PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
(COGL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
cogl_get_proc_address ("glFramebufferTexture2DEXT");
ctx->pf_glFramebufferRenderbufferEXT =
(PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
(COGL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
cogl_get_proc_address ("glFramebufferRenderbufferEXT");
ctx->pf_glCheckFramebufferStatusEXT =
(PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
(COGL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
cogl_get_proc_address ("glCheckFramebufferStatusEXT");
ctx->pf_glDeleteFramebuffersEXT =
(PFNGLDELETEFRAMEBUFFERSEXTPROC)
(COGL_PFNGLDELETEFRAMEBUFFERSEXTPROC)
cogl_get_proc_address ("glDeleteFramebuffersEXT");
if (ctx->pf_glGenRenderbuffersEXT &&
@ -747,7 +747,7 @@ _cogl_features_init ()
if (cogl_check_extension ("GL_EXT_framebuffer_blit", gl_extensions))
{
ctx->pf_glBlitFramebufferEXT =
(PFNGLBLITFRAMEBUFFEREXTPROC)
(COGL_PFNGLBLITFRAMEBUFFEREXTPROC)
cogl_get_proc_address ("glBlitFramebufferEXT");
if (ctx->pf_glBlitFramebufferEXT)
@ -757,7 +757,7 @@ _cogl_features_init ()
if (cogl_check_extension ("GL_EXT_framebuffer_multisample", gl_extensions))
{
ctx->pf_glRenderbufferStorageMultisampleEXT =
(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)
(COGL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)
cogl_get_proc_address ("glRenderbufferStorageMultisampleEXT");
if (ctx->pf_glRenderbufferStorageMultisampleEXT)