From: Oliver O. <fr...@us...> - 2007-06-17 13:39:37
|
Update of /cvsroot/simspark/simspark/spark/kerosin/textureserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21072/kerosin/textureserver Modified Files: texture.cpp texture.h texture2d.cpp texture2d.h textureserver.cpp textureserver.h Log Message: merge from projectx branch Index: texture2d.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture2d.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texture2d.cpp 15 Mar 2007 07:26:26 -0000 1.2 --- texture2d.cpp 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 1,22 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! 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; version 2 of the License. ! 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 this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "texture2d.h" --- 1,22 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! 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; version 2 of the License. ! 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 this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "texture2d.h" *************** *** 26,30 **** using namespace kerosin; ! Texture2D::Texture2D() : Texture() { } --- 26,30 ---- using namespace kerosin; ! Texture2D::Texture2D(bool use_gl) : Texture(use_gl) { } Index: textureserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/textureserver.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** textureserver.cpp 15 Mar 2007 07:26:26 -0000 1.2 --- textureserver.cpp 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 1,22 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! 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; version 2 of the License. ! 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 this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ --- 1,22 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! 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; version 2 of the License. ! 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 this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ *************** *** 54,57 **** --- 54,59 ---- } #endif + // setup OpenGLServer reference + RegisterCachedPath(mOpenGLServer, "/sys/server/opengl"); } *************** *** 61,73 **** if (entry != mTextureCache.end()) ! { ! // we already have a match ! return (*entry).second; ! } ! if (mImageServer.expired()) ! { ! return shared_ptr<Texture>(); ! } #ifdef WIN32 --- 63,75 ---- if (entry != mTextureCache.end()) ! { ! // we already have a match ! return (*entry).second; ! } ! if (mImageServer.expired()) ! { ! return shared_ptr<Texture>(); ! } #ifdef WIN32 *************** *** 78,86 **** if (! image.get()) ! { ! return shared_ptr<Texture>(); ! } ! Texture2D *tex2D = new Texture2D(); tex2D->Create(image); shared_ptr<Texture> texture(tex2D); --- 80,94 ---- if (! image.get()) ! { ! return shared_ptr<Texture>(); ! } ! bool use_gl = false; ! if (!mOpenGLServer.expired()) ! { ! use_gl = !mOpenGLServer->IsGLLocked(); ! } ! ! Texture2D *tex2D = new Texture2D(use_gl); tex2D->Create(image); shared_ptr<Texture> texture(tex2D); Index: textureserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/textureserver.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** textureserver.h 15 Mar 2007 07:26:26 -0000 1.2 --- textureserver.h 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 24,43 **** #ifdef HAVE_CONFIG_H - #ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT - #endif - #ifdef PACKAGE_NAME #undef PACKAGE_NAME - #endif - #ifdef PACKAGE_STRING #undef PACKAGE_STRING - #endif - #ifdef PACKAGE_TARNAME #undef PACKAGE_TARNAME - #endif - #ifdef PACKAGE_VERSION #undef PACKAGE_VERSION ! #endif ! #include <config.h> #endif --- 24,33 ---- #ifdef HAVE_CONFIG_H #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION ! #include <sparkconfig.h> #endif *************** *** 79,87 **** virtual ~TextureServer(); - /** retrieve pointer to the OpenGL server ... used by Textures to - check extensions - */ - boost::shared_ptr<OpenGLServer> GetOpenGLServer() const; - /** load (or returned cached) texture */ boost::shared_ptr<Texture> GetTexture(const std::string &name); --- 69,72 ---- *************** *** 97,101 **** /** reference to the ImageServer */ CachedPath<ImageServer> mImageServer; ! /** registry of cached textures */ TTextureCache mTextureCache; --- 82,87 ---- /** reference to the ImageServer */ CachedPath<ImageServer> mImageServer; ! /** reference to the OpenGLServer */ ! CachedPath<OpenGLServer> mOpenGLServer; /** registry of cached textures */ TTextureCache mTextureCache; Index: texture.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texture.cpp 15 Mar 2007 07:26:26 -0000 1.2 --- texture.cpp 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 1,22 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! 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; version 2 of the License. ! 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 this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "texture.h" --- 1,22 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark ! Fri May 9 2003 ! Copyright (C) 2002,2003 Koblenz University ! Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group ! $Id$ ! 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; version 2 of the License. ! 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 this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "texture.h" *************** *** 25,30 **** using namespace kerosin; ! Texture::Texture() ! : mTexID(0), mWidth(0), mHeight(0) { } --- 25,30 ---- using namespace kerosin; ! Texture::Texture(bool use_gl) ! : mTexID(0), mWidth(0), mHeight(0), mUseGL(use_gl) { } *************** *** 35,61 **** } ! void Texture::Reset() { if (! mTexID) ! { ! return; ! } ! glDeleteTextures(1, &mTexID); mTexID = 0; } ! void Texture::Acquire() { Reset(); ! glGenTextures(1, &mTexID); } ! unsigned int Texture::GetWidth() const { return mWidth; } ! unsigned int Texture::GetHeight() const { return mHeight; --- 35,65 ---- } ! void ! Texture::Reset() { if (! mTexID) ! { ! return; ! } ! if (mUseGL) glDeleteTextures(1, &mTexID); mTexID = 0; } ! void ! Texture::Acquire() { Reset(); ! if (mUseGL) glGenTextures(1, &mTexID); } ! unsigned int ! Texture::GetWidth() const { return mWidth; } ! unsigned int ! Texture::GetHeight() const { return mHeight; Index: texture2d.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture2d.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texture2d.h 15 Mar 2007 07:26:26 -0000 1.2 --- texture2d.h 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 36,40 **** // public: ! Texture2D(); ~Texture2D(); --- 36,40 ---- // public: ! Texture2D(bool use_gl = false); ~Texture2D(); Index: texture.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texture.h 15 Mar 2007 07:26:26 -0000 1.2 --- texture.h 17 Jun 2007 13:38:31 -0000 1.3 *************** *** 58,62 **** // public: ! Texture(); virtual ~Texture(); --- 58,62 ---- // public: ! Texture(bool use_gl = false); virtual ~Texture(); *************** *** 97,106 **** //! OpenGL texture handle GLuint mTexID; - //! width of texture unsigned int mWidth; - //! height of texture unsigned int mHeight; }; --- 97,106 ---- //! OpenGL texture handle GLuint mTexID; //! width of texture unsigned int mWidth; //! height of texture unsigned int mHeight; + //! flag if we want to access OpenGL + bool mUseGL; }; |