2013-01-10 19:11:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2013 Gregory hainaut
|
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2013-01-17 16:58:48 +00:00
|
|
|
#ifdef _LINUX
|
|
|
|
#include <GL/glx.h>
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
#include <EGL/eglext.h>
|
|
|
|
#endif
|
|
|
|
|
2013-01-14 09:15:39 +00:00
|
|
|
#ifdef _WINDOWS
|
2013-05-19 09:19:20 +00:00
|
|
|
#define GL_LOADFN(name, glName) { \
|
|
|
|
if( (*(void**)&name = (void*)wglGetProcAddress(#glName)) == NULL ) { \
|
|
|
|
fprintf(stderr,"Failed to find %s\n", #glName); \
|
2013-01-14 09:15:39 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
#else
|
2013-01-17 16:58:48 +00:00
|
|
|
#ifdef EGL_API
|
2013-05-19 09:19:20 +00:00
|
|
|
#define GL_LOADFN(name, glName) { \
|
|
|
|
if( (*(void**)&name = (void*)eglGetProcAddress(#glName)) == NULL ) { \
|
|
|
|
fprintf(stderr,"Failed to find %s\n", #glName); \
|
2013-01-17 16:58:48 +00:00
|
|
|
} \
|
2013-01-14 09:15:39 +00:00
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
#else
|
2013-05-19 09:19:20 +00:00
|
|
|
#define GL_LOADFN(name, glName) { \
|
|
|
|
if( (*(void**)&name = (void*)glXGetProcAddress((const GLubyte*)#glName)) == NULL ) { \
|
|
|
|
fprintf(stderr,"Failed to find %s\n", #glName); \
|
2013-01-17 16:58:48 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
#endif
|
2013-01-14 09:15:39 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-19 09:19:20 +00:00
|
|
|
extern PFNGLACTIVETEXTUREPROC gl_ActiveTexture;
|
|
|
|
extern PFNGLBLENDCOLORPROC gl_BlendColor;
|
|
|
|
extern PFNGLATTACHSHADERPROC gl_AttachShader;
|
|
|
|
extern PFNGLBINDBUFFERPROC gl_BindBuffer;
|
|
|
|
extern PFNGLBINDBUFFERBASEPROC gl_BindBufferBase;
|
|
|
|
extern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC gl_BindFragDataLocationIndexed;
|
|
|
|
extern PFNGLBINDFRAMEBUFFERPROC gl_BindFramebuffer;
|
|
|
|
extern PFNGLBINDPROGRAMPIPELINEPROC gl_BindProgramPipeline;
|
|
|
|
extern PFNGLBINDSAMPLERPROC gl_BindSampler;
|
|
|
|
extern PFNGLBINDVERTEXARRAYPROC gl_BindVertexArray;
|
|
|
|
extern PFNGLBLENDEQUATIONSEPARATEPROC gl_BlendEquationSeparate;
|
|
|
|
extern PFNGLBLENDFUNCSEPARATEPROC gl_BlendFuncSeparate;
|
|
|
|
extern PFNGLBLITFRAMEBUFFERPROC gl_BlitFramebuffer;
|
|
|
|
extern PFNGLBUFFERDATAPROC gl_BufferData;
|
|
|
|
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC gl_CheckFramebufferStatus;
|
|
|
|
extern PFNGLCLEARBUFFERFVPROC gl_ClearBufferfv;
|
|
|
|
extern PFNGLCLEARBUFFERIVPROC gl_ClearBufferiv;
|
|
|
|
extern PFNGLCOMPILESHADERPROC gl_CompileShader;
|
|
|
|
extern PFNGLCOPYIMAGESUBDATANVPROC gl_CopyImageSubDataNV;
|
|
|
|
extern PFNGLCREATEPROGRAMPROC gl_CreateProgram;
|
|
|
|
extern PFNGLCREATESHADERPROC gl_CreateShader;
|
|
|
|
extern PFNGLCREATESHADERPROGRAMVPROC gl_CreateShaderProgramv;
|
|
|
|
extern PFNGLDELETEBUFFERSPROC gl_DeleteBuffers;
|
|
|
|
extern PFNGLDELETEFRAMEBUFFERSPROC gl_DeleteFramebuffers;
|
|
|
|
extern PFNGLDELETEPROGRAMPROC gl_DeleteProgram;
|
|
|
|
extern PFNGLDELETEPROGRAMPIPELINESPROC gl_DeleteProgramPipelines;
|
|
|
|
extern PFNGLDELETESAMPLERSPROC gl_DeleteSamplers;
|
|
|
|
extern PFNGLDELETESHADERPROC gl_DeleteShader;
|
|
|
|
extern PFNGLDELETEVERTEXARRAYSPROC gl_DeleteVertexArrays;
|
|
|
|
extern PFNGLDETACHSHADERPROC gl_DetachShader;
|
|
|
|
extern PFNGLDRAWBUFFERSPROC gl_DrawBuffers;
|
|
|
|
extern PFNGLDRAWELEMENTSBASEVERTEXPROC gl_DrawElementsBaseVertex;
|
|
|
|
extern PFNGLENABLEVERTEXATTRIBARRAYPROC gl_EnableVertexAttribArray;
|
|
|
|
extern PFNGLFRAMEBUFFERRENDERBUFFERPROC gl_FramebufferRenderbuffer;
|
|
|
|
extern PFNGLFRAMEBUFFERTEXTURE2DPROC gl_FramebufferTexture2D;
|
|
|
|
extern PFNGLGENBUFFERSPROC gl_GenBuffers;
|
|
|
|
extern PFNGLGENFRAMEBUFFERSPROC gl_GenFramebuffers;
|
|
|
|
extern PFNGLGENPROGRAMPIPELINESPROC gl_GenProgramPipelines;
|
|
|
|
extern PFNGLGENSAMPLERSPROC gl_GenSamplers;
|
|
|
|
extern PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays;
|
|
|
|
extern PFNGLGETBUFFERPARAMETERIVPROC gl_GetBufferParameteriv;
|
|
|
|
extern PFNGLGETDEBUGMESSAGELOGARBPROC gl_GetDebugMessageLogARB;
|
|
|
|
extern PFNGLGETFRAGDATAINDEXPROC gl_GetFragDataIndex;
|
|
|
|
extern PFNGLGETFRAGDATALOCATIONPROC gl_GetFragDataLocation;
|
|
|
|
extern PFNGLGETPROGRAMINFOLOGPROC gl_GetProgramInfoLog;
|
|
|
|
extern PFNGLGETPROGRAMIVPROC gl_GetProgramiv;
|
|
|
|
extern PFNGLGETSHADERIVPROC gl_GetShaderiv;
|
|
|
|
extern PFNGLGETSTRINGIPROC gl_GetStringi;
|
|
|
|
extern PFNGLISFRAMEBUFFERPROC gl_IsFramebuffer;
|
|
|
|
extern PFNGLLINKPROGRAMPROC gl_LinkProgram;
|
|
|
|
extern PFNGLMAPBUFFERPROC gl_MapBuffer;
|
|
|
|
extern PFNGLMAPBUFFERRANGEPROC gl_MapBufferRange;
|
|
|
|
extern PFNGLPROGRAMPARAMETERIPROC gl_ProgramParameteri;
|
|
|
|
extern PFNGLSAMPLERPARAMETERFPROC gl_SamplerParameterf;
|
|
|
|
extern PFNGLSAMPLERPARAMETERIPROC gl_SamplerParameteri;
|
|
|
|
extern PFNGLSHADERSOURCEPROC gl_ShaderSource;
|
|
|
|
extern PFNGLUNIFORM1IPROC gl_Uniform1i;
|
|
|
|
extern PFNGLUNMAPBUFFERPROC gl_UnmapBuffer;
|
|
|
|
extern PFNGLUSEPROGRAMSTAGESPROC gl_UseProgramStages;
|
|
|
|
extern PFNGLVERTEXATTRIBIPOINTERPROC gl_VertexAttribIPointer;
|
|
|
|
extern PFNGLVERTEXATTRIBPOINTERPROC gl_VertexAttribPointer;
|
2013-05-19 12:42:55 +00:00
|
|
|
extern PFNGLTEXSTORAGE2DPROC gl_TexStorage2D;
|
2013-06-07 19:16:27 +00:00
|
|
|
extern PFNGLBUFFERSUBDATAPROC gl_BufferSubData;
|
2013-05-19 12:42:55 +00:00
|
|
|
// NO GL4.1
|
|
|
|
extern PFNGLUSEPROGRAMPROC gl_UseProgram;
|
|
|
|
extern PFNGLGETSHADERINFOLOGPROC gl_GetShaderInfoLog;
|
2013-05-26 13:05:03 +00:00
|
|
|
extern PFNGLPROGRAMUNIFORM1IPROC gl_ProgramUniform1i;
|
2013-05-19 12:42:55 +00:00
|
|
|
// NO GL4.2
|
|
|
|
extern PFNGLGETUNIFORMBLOCKINDEXPROC gl_GetUniformBlockIndex;
|
|
|
|
extern PFNGLUNIFORMBLOCKBINDINGPROC gl_UniformBlockBinding;
|
2013-05-25 14:28:16 +00:00
|
|
|
extern PFNGLGETUNIFORMLOCATIONPROC gl_GetUniformLocation;
|
2013-05-19 12:42:55 +00:00
|
|
|
|
2013-01-10 19:11:03 +00:00
|
|
|
|
2013-01-14 09:15:39 +00:00
|
|
|
namespace GLLoader {
|
|
|
|
bool check_gl_version(uint32 major, uint32 minor);
|
|
|
|
void init_gl_function();
|
|
|
|
bool check_gl_supported_extension();
|
2013-05-19 12:42:55 +00:00
|
|
|
|
|
|
|
extern bool found_GL_ARB_separate_shader_objects;
|
|
|
|
extern bool found_GL_ARB_shading_language_420pack;
|
|
|
|
extern bool found_GL_ARB_texture_storage;
|
2013-05-27 16:53:38 +00:00
|
|
|
extern bool found_GL_ARB_copy_image;
|
|
|
|
extern bool found_GL_NV_copy_image;
|
|
|
|
extern bool found_geometry_shader;
|
2013-05-19 12:42:55 +00:00
|
|
|
extern bool fglrx_buggy_driver;
|
2013-05-27 18:02:27 +00:00
|
|
|
extern bool found_only_gl30;
|
2013-01-10 19:11:03 +00:00
|
|
|
}
|