Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/mevis/include/Inventor/elements/SoGLVBOElement.h
Go to the documentation of this file.
00001 /*
00002 *
00003 *  Copyright (C) 2011 MeVis Medical Solutions AG  All Rights Reserved.
00004 *
00005 *  This library is free software; you can redistribute it and/or
00006 *  modify it under the terms of the GNU Lesser General Public
00007 *  License as published by the Free Software Foundation; either
00008 *  version 2.1 of the License, or (at your option) any later version.
00009 *
00010 *  This library is distributed in the hope that it will be useful,
00011 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 *  Lesser General Public License for more details.
00014 *
00015 *  Further, this software is distributed without any warranty that it is
00016 *  free of the rightful claim of any third person regarding infringement
00017 *  or the like.  Any license provided herein, whether implied or
00018 *  otherwise, applies only to this software file.  Patent licenses, if
00019 *  any, provided herein do not apply to combinations of this program with
00020 *  other software, or any other product whatsoever.
00021 *
00022 *  You should have received a copy of the GNU Lesser General Public
00023 *  License along with this library; if not, write to the Free Software
00024 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *
00026 *  Contact information: MeVis, Center for Medical Diagnostic Systems and
00027 *  Visualization GmbH, Universitätsallee 29, D-28359 Bremen, GERMANY, or:
00028 *
00029 *  http://www.mevis.de
00030 *
00031 */
00032 
00033 /*
00034  Author: Florian Link
00035  Date:   09-2011
00036 */
00037 
00038 #ifndef _SO_GL_VBO_ELEMENT_
00039 #define _SO_GL_VBO_ELEMENT_
00040 
00041 #include <Inventor/system/SbSystem.h>
00042 #include <Inventor/elements/SoSubElement.h>
00043 #include <Inventor/misc/SoVBO.h>
00044 #include <Inventor/SoMachine.h>
00045 
00048 SoEXTENDER class INVENTOR_API SoGLVBOElement : public SoElement
00049 {
00050   typedef SoElement inherited;
00051 
00052   SO_ELEMENT_HEADER(SoGLVBOElement);
00053 
00054 public:
00055   enum VBOType {
00056     VERTEX_VBO = 0,
00057     NORMAL_VBO = 1,
00058     COLOR_VBO  = 2,
00059     TEXCOORD_VBO = 3,
00060     MAX_VBO_TYPES = 4
00061   };
00062 
00063   virtual void      init(SoState *state);
00064   virtual void      push(SoState *state);
00065   virtual void      pop(SoState *state, const SoElement *childElt);
00066 
00068   static const SoGLVBOElement*   getInstance(SoState* state);
00069 
00071   static void unsetVBO(SoState* state, VBOType type);
00073   static void unsetVBOIfEnabled(SoState* state, VBOType type);
00074 
00077   static void updateVBO(SoState* state, VBOType type, SoVBO** vbo, int numBytes = 0, const void* data = NULL, uint32_t nodeId = 0);
00078 
00080   SoVBO* getVBO(VBOType type) const;
00081 
00082   SbBool            matches(const SoElement *elt) const;
00083   SoElement*        copyMatchInfo() const;
00084 
00085 protected:
00086 
00088   virtual           ~SoGLVBOElement();
00089 
00090 SoINTERNAL public:
00091 
00093   static void       initClass();
00094 
00095 private:
00096   SoVBO* _vbo[MAX_VBO_TYPES];
00097 
00098 };
00099 
00100 #endif  // _SO_GL_VBO_ELEMENT_