Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
glgeometry.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_HW_GLGEOMETRY_H_)
21 #define __MITSUBA_HW_GLGEOMETRY_H_
22 
23 #include <mitsuba/hw/glrenderer.h>
24 #include <mitsuba/hw/gpugeometry.h>
25 
27 
28 /** \brief OpenGL-based GPUGeometry implementation
29  * \ingroup libhw
30  */
32  friend class GLRenderer;
33 public:
34  /// Create a new GLGeometry instance for the given mesh
35  GLGeometry(const TriMesh *mesh);
36 
37  /// Upload the geometry object
38  void init();
39 
40  /// Refresh (re-upload) the geometry object
41  void refresh();
42 
43  /// Bind the geometry object
44  void bind();
45 
46  /// Unbind the geometry object
47  void unbind();
48 
49  /// Free the geometry object from GPU memory
50  void cleanup();
51 
53 protected:
54  /// Virtual destructor
55  virtual ~GLGeometry();
56 protected:
57  enum EIdentifier {
58  EVertexID = 0,
59  EIndexID = 1
60  };
61 
62  GLuint m_id[2];
63  GLuint64 m_addr[2];
64  GLuint m_size[2];
65  int m_stride;
66 };
67 
69 
70 #endif /* __MITSUBA_HW_GLGEOMETRY_H_ */
Abstract triangle mesh base class.
Definition: trimesh.h:68
EIdentifier
Definition: glgeometry.h:57
virtual void init()=0
Upload the geometry object.
#define MTS_EXPORT_HW
Definition: platform.h:114
int m_stride
Definition: glgeometry.h:65
OpenGL-based GPUGeometry implementation.
Definition: glgeometry.h:31
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
virtual void cleanup()=0
Free the geometry object from GPU memory.
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
virtual void refresh()=0
Refresh (re-upload) the geometry object.
Abstract geometry storage on a graphics card.
Definition: gpugeometry.h:32
virtual void unbind()=0
Unbind the geometry object.
virtual void bind()=0
Bind the geometry object.
OpenGL implementation of the Renderer interface.
Definition: glrenderer.h:43
#define MTS_NAMESPACE_END
Definition: platform.h:138