From: Markus R. <rol...@us...> - 2007-02-23 19:19:23
|
Update of /cvsroot/simspark/simspark/spark/kerosin/openglserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4119 Modified Files: Tag: WIN32 openglserver.cpp openglserver.h Log Message: - further cleanup of openglserver Index: openglserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/openglserver/openglserver.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** openglserver.cpp 10 Feb 2007 16:17:28 -0000 1.1.2.1 --- openglserver.cpp 23 Feb 2007 19:19:15 -0000 1.1.2.2 *************** *** 20,25 **** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "openglserver.h" #include "openglsystem.h" #include <zeitgeist/scriptserver/scriptserver.h> --- 20,25 ---- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "openglserver.h" + #include "openglwrapper.h" #include "openglsystem.h" #include <zeitgeist/scriptserver/scriptserver.h> *************** *** 86,160 **** } - unsigned int OpenGLServer::LoadARBProgram(GLenum /*target*/, const char* /*fileName*/) - { - #if 0 - // only try to load stuff if the extension is supported - if (!mExtensionReg->Has_GL_ARB_vertex_program()) - { - return 0; - } - - // before actually loading, try the cache - MapHolder::TProgramCache::iterator entry = mHolder->mPrograms.find(fileName); - - if (entry != mHolder->mPrograms.end()) - { - // we already have a match - return (*entry).second; - } - - unsigned int id = 0; - - // open file - shared_ptr<FileServer> fileServer = shared_static_cast<FileServer>(GetCore()->Get("/sys/server/file")); - salt::RFile *file = fileServer->Open(fileName); - - if (!file) return 0; - - unsigned char *buffer = new unsigned char[file->Size()+1]; - file->Read(buffer, file->Size()); - - glGenProgramsARB(1, &id); - glBindProgramARB(target, id); - - // try to load the actual program - glProgramStringARB(target, GL_PROGRAM_FORMAT_ASCII_ARB, file->Size(), buffer); - - // free memory - delete file; - delete []buffer; - - const unsigned char* error = glGetString(GL_PROGRAM_ERROR_STRING_ARB); - - // if an error occured, display error message - if (error[0] != 0) - { - int i; - glDeleteProgramsARB(1, &id); - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &i); - GetCore()->GetLogServer()->Error() << "ERROR: Loading ARB program (Pos: " << i << ")..." << endl; - GetCore()->GetLogServer()->Error() << " => " << error << endl; - return 0; - } - - // enter program into the cache - mHolder->mPrograms[fileName] = id; - - return id; - #else - return 0; - #endif - } - - unsigned int OpenGLServer::LoadARBVertexProgram(const char* fileName) - { - return 0; - } - - unsigned int OpenGLServer::LoadARBFragmentProgram(const char* /*fileName*/) - { - return 0; - } - bool OpenGLServer::Init(const string& openGLSysName) { --- 86,89 ---- *************** *** 203,214 **** } - void OpenGLServer::ToggleFancyLighting() - { - if (mSupportsFancyLighting) - mSupportsFancyLighting = false; - else - mSupportsFancyLighting = true; - } - int OpenGLServer::AllocLight() --- 132,135 ---- *************** *** 245,249 **** static _ptr proc = (_ptr) GetExtension(#_function); ! void OpenGLServer::glActiveTextureARB(GLenum texture) { PROC_ADDRESS(PFNGLACTIVETEXTUREARBPROC, "glActiveTextureARB"); --- 166,170 ---- static _ptr proc = (_ptr) GetExtension(#_function); ! void OpenGLServer::glActiveTextureARB(unsigned int texture) { PROC_ADDRESS(PFNGLACTIVETEXTUREARBPROC, "glActiveTextureARB"); *************** *** 254,257 **** } ! (proc)(texture); } --- 175,178 ---- } ! (proc)(static_cast<GLenum>(texture)); } Index: openglserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/openglserver/openglserver.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** openglserver.h 10 Feb 2007 16:17:28 -0000 1.1.2.1 --- openglserver.h 23 Feb 2007 19:19:15 -0000 1.1.2.2 *************** *** 28,48 **** #include <zeitgeist/leaf.h> - #define GL_GLEXT_PROTOTYPES - - #ifdef WIN32 - #define WIN32_LEAN_AND_MEAN 1 - #include <windows.h> - #endif - - #include <GL/gl.h> - #include <GL/glext.h> - - #if defined(WIN32) - #include <GL/wglext.h> - #else - #include <GL/glx.h> - #include <GL/glxext.h> - #endif - namespace kerosin { --- 28,31 ---- *************** *** 60,70 **** // protected: - //! this structure will be used to map program names to OpenGL IDs - // #if HAVE_HASH_MAP - // typedef std::hash_map<std::string, unsigned int> TProgramCache; - // #else - // typedef std::map<std::string, unsigned int> TProgramCache; - // #endif - //! set of OpenGL light constants typedef std::set<int> TLightSet; --- 43,46 ---- *************** *** 96,111 **** void SwapBuffers() const; - //! vertex and fragment program loading - unsigned int LoadARBProgram(GLenum target, const char* fileName); - - //! vertex and fragment program loading - unsigned int LoadARBVertexProgram(const char* fileName); - - //! vertex and fragment program loading - unsigned int LoadARBFragmentProgram(const char* fileName); - - bool SupportsFancyLighting() const { return mSupportsFancyLighting; } - void ToggleFancyLighting(); - /** returns the next availble GL light constant or -1 if no more lights are available --- 72,75 ---- *************** *** 120,124 **** /** looksup and calls glActiveTextureARB extension if available */ ! static void glActiveTextureARB(GLenum texture); protected: --- 84,88 ---- /** looksup and calls glActiveTextureARB extension if available */ ! static void glActiveTextureARB(unsigned int texture); protected: |