Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/OGLExtensions.cpp
2 views
/* OGLExtensions.cpp1Copyright (C) 2009 Richard Goedeken23This program is free software; you can redistribute it and/or4modify it under the terms of the GNU General Public License5as published by the Free Software Foundation; either version 26of the License, or (at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program; if not, write to the Free Software15Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.16*/1718/* This source file contains code for assigning function pointers to some OpenGL functions */19/* This is only necessary because Windows does not contain development support for OpenGL versions beyond 1.1 */2021#include <SDL_opengl.h>22#include "OGLExtensions.h"23#include "Video.h"2425static void APIENTRY EmptyFunc(void) { return; }2627bool bNvidiaExtensionsSupported = false;28PFUNCGLCOMBINERPARAMETERFVNVPROC pglCombinerParameterfvNV = (PFUNCGLCOMBINERPARAMETERFVNVPROC) EmptyFunc;29PFUNCGLFINALCOMBINERINPUTNVPROC pglFinalCombinerInputNV = (PFUNCGLFINALCOMBINERINPUTNVPROC) EmptyFunc;30PFUNCGLCOMBINEROUTPUTNVPROC pglCombinerOutputNV = (PFUNCGLCOMBINEROUTPUTNVPROC) EmptyFunc;31PFUNCGLCOMBINERINPUTNVPROC pglCombinerInputNV = (PFUNCGLCOMBINERINPUTNVPROC) EmptyFunc;32PFUNCGLCOMBINERPARAMETERINVPROC pglCombinerParameteriNV = (PFUNCGLCOMBINERPARAMETERINVPROC) EmptyFunc;3334PFUNCGLACTIVETEXTUREPROC pglActiveTexture = (PFUNCGLACTIVETEXTUREPROC) EmptyFunc;35PFUNCGLACTIVETEXTUREARBPROC pglActiveTextureARB = (PFUNCGLACTIVETEXTUREARBPROC) EmptyFunc;36PFUNCGLMULTITEXCOORD2FPROC pglMultiTexCoord2f = (PFUNCGLMULTITEXCOORD2FPROC) EmptyFunc;37PFUNCGLMULTITEXCOORD2FVPROC pglMultiTexCoord2fv = (PFUNCGLMULTITEXCOORD2FVPROC) EmptyFunc;38PFUNCGLDELETEPROGRAMSARBPROC pglDeleteProgramsARB = (PFUNCGLDELETEPROGRAMSARBPROC) EmptyFunc;39PFUNCGLPROGRAMSTRINGARBPROC pglProgramStringARB = (PFUNCGLPROGRAMSTRINGARBPROC) EmptyFunc;40PFUNCGLBINDPROGRAMARBPROC pglBindProgramARB = (PFUNCGLBINDPROGRAMARBPROC) EmptyFunc;41PFUNCGLGENPROGRAMSARBPROC pglGenProgramsARB = (PFUNCGLGENPROGRAMSARBPROC) EmptyFunc;42PFUNCGLPROGRAMENVPARAMETER4FVARBPROC pglProgramEnvParameter4fvARB = (PFUNCGLPROGRAMENVPARAMETER4FVARBPROC) EmptyFunc;43PFUNCGLFOGCOORDPOINTEREXTPROC pglFogCoordPointerEXT = (PFUNCGLFOGCOORDPOINTEREXTPROC) EmptyFunc;44PFUNCGLCLIENTACTIVETEXTUREARBPROC pglClientActiveTextureARB = (PFUNCGLCLIENTACTIVETEXTUREARBPROC) EmptyFunc;4546#define INIT_ENTRY_POINT(type, funcname) \47p##funcname = (type) CoreVideo_GL_GetProcAddress(#funcname); \48if (p##funcname == NULL) { DebugMessage(M64MSG_WARNING, \49"Couldn't get address of OpenGL function: '%s'", #funcname); p##funcname = (type) EmptyFunc; }5051void OGLExtensions_Init(void)52{53/* nvidia extensions are a special case */54bNvidiaExtensionsSupported = true;55pglCombinerParameterfvNV = (PFUNCGLCOMBINERPARAMETERFVNVPROC) CoreVideo_GL_GetProcAddress("glCombinerParameterfvNV");56if (pglCombinerParameterfvNV == NULL) bNvidiaExtensionsSupported = false;57pglFinalCombinerInputNV = (PFUNCGLFINALCOMBINERINPUTNVPROC) CoreVideo_GL_GetProcAddress("glFinalCombinerInputNV");58if (pglFinalCombinerInputNV == NULL) bNvidiaExtensionsSupported = false;59pglCombinerOutputNV = (PFUNCGLCOMBINEROUTPUTNVPROC) CoreVideo_GL_GetProcAddress("glCombinerOutputNV");60if (pglCombinerOutputNV == NULL) bNvidiaExtensionsSupported = false;61pglCombinerInputNV = (PFUNCGLCOMBINERINPUTNVPROC) CoreVideo_GL_GetProcAddress("glCombinerInputNV");62if (pglCombinerInputNV == NULL) bNvidiaExtensionsSupported = false;63pglCombinerParameteriNV = (PFUNCGLCOMBINERPARAMETERINVPROC) CoreVideo_GL_GetProcAddress("glCombinerParameteriNV");64if (pglCombinerParameteriNV == NULL) bNvidiaExtensionsSupported = false;6566INIT_ENTRY_POINT(PFUNCGLACTIVETEXTUREPROC, glActiveTexture);67INIT_ENTRY_POINT(PFUNCGLACTIVETEXTUREARBPROC, glActiveTextureARB);68INIT_ENTRY_POINT(PFUNCGLMULTITEXCOORD2FPROC, glMultiTexCoord2f);69INIT_ENTRY_POINT(PFUNCGLMULTITEXCOORD2FVPROC, glMultiTexCoord2fv);70INIT_ENTRY_POINT(PFUNCGLDELETEPROGRAMSARBPROC, glDeleteProgramsARB);71INIT_ENTRY_POINT(PFUNCGLPROGRAMSTRINGARBPROC, glProgramStringARB);72INIT_ENTRY_POINT(PFUNCGLBINDPROGRAMARBPROC, glBindProgramARB);73INIT_ENTRY_POINT(PFUNCGLGENPROGRAMSARBPROC, glGenProgramsARB);74INIT_ENTRY_POINT(PFUNCGLPROGRAMENVPARAMETER4FVARBPROC, glProgramEnvParameter4fvARB);75INIT_ENTRY_POINT(PFUNCGLFOGCOORDPOINTEREXTPROC, glFogCoordPointerEXT);76INIT_ENTRY_POINT(PFUNCGLCLIENTACTIVETEXTUREARBPROC, glClientActiveTextureARB);77}7879808182