00001 #ifndef MERCURYOGLEXT_H 00002 #define MERCURYOGLEXT_H 00003 00004 #if defined (WIN32) 00005 #include <GL/glaux.h> 00006 #endif 00007 00008 #include <GL/gl.h> 00009 #if defined (WIN32) 00010 #include "glext.h" 00011 #else 00012 #include <GL/glext.h> 00013 #endif 00014 00015 #include "MercuryUtil.h" 00016 #include <map> 00017 00018 00019 typedef bool (APIENTRY * PWSWAPINTERVALEXTPROC) (int interval); 00020 void* GetProcAddress( MString s ); 00021 00022 struct GLExtensions 00023 { 00024 bool IsExtension(const MString& ext) const; 00025 std::map<MString, bool> m_extensions; 00026 }; 00027 00028 void InitOpenglApiExtensions(); 00029 void PopulateExtensions(GLExtensions& ext); 00030 00031 //Functions from extenstions 00032 extern PWSWAPINTERVALEXTPROC wglSwapIntervalEXT; 00033 00034 extern PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARBm; 00035 extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARBm; 00036 extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARBm; 00037 extern PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARBm; 00038 extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARBm; 00039 extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARBm; 00040 00041 extern PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB; 00042 extern PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB; 00043 00044 //glslang 00045 extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; 00046 extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; 00047 extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB; 00048 extern PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB; 00049 extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; 00050 extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB ; 00051 extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB; 00052 extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB; 00053 extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; 00054 extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB; 00055 extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB; 00056 extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB; 00057 extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; 00058 extern PFNGLUNIFORM1FARBPROC glUniform1fARB; 00059 extern PFNGLUNIFORM2FARBPROC glUniform2fARB; 00060 extern PFNGLUNIFORM3FARBPROC glUniform3fARB; 00061 extern PFNGLUNIFORM4FARBPROC glUniform4fARB; 00062 extern PFNGLUNIFORM1IARBPROC glUniform1iARB; 00063 extern PFNGLUNIFORM2IARBPROC glUniform2iARB; 00064 extern PFNGLUNIFORM3IARBPROC glUniform3iARB; 00065 extern PFNGLUNIFORM4IARBPROC glUniform4iARB; 00066 extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; 00067 extern PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB; 00068 00069 extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; 00070 extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB; 00071 extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; 00072 00073 extern bool mercuryIsSupportFrameBufferObjectEXT; 00074 extern bool supportAnisotrophy; 00075 00076 // EXT_framebuffer_object - http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt 00077 extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT; 00078 extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; 00079 extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; 00080 extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; 00081 extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; 00082 extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT; 00083 extern PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT; 00084 extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; 00085 extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; 00086 extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; 00087 extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; 00088 extern PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT; 00089 extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; 00090 extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT; 00091 extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; 00092 extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT; 00093 extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; 00094 00095 //VBO 00096 extern PFNGLBINDBUFFERARBPROC glBindBufferARB; 00097 extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; 00098 extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; 00099 extern PFNGLBUFFERDATAARBPROC glBufferDataARB; 00100 00101 extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT; 00102 extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT; 00103 00104 #endif 00105 00106 /* 00107 * Copyright (c) 2005-2006, Joshua Allen 00108 * All rights reserved. 00109 * 00110 * Redistribution and use in source and binary forms, with or 00111 * without modification, are permitted provided that the following 00112 * conditions are met: 00113 * - Redistributions of source code must retain the above 00114 * copyright notice, this list of conditions and the following disclaimer. 00115 * - Redistributions in binary form must reproduce the above copyright 00116 * notice, this list of conditions and the following disclaimer in 00117 * the documentation and/or other materials provided with the distribution. 00118 * - Neither the name of the Mercury Engine nor the names of its 00119 * contributors may be used to endorse or promote products derived from 00120 * this software without specific prior written permission. 00121 * 00122 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00123 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00124 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00125 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 00126 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00127 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00128 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00129 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00130 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00131 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00132 */