Vis 2 Demo  1.0
Technical illustration type real-time rendering of geometry
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
vis2::GeometricObjectTextured Class Referenceabstract

This is the base class for all objects that require both geometry and a texture to be drawn by OpenGL. More...

Inheritance diagram for vis2::GeometricObjectTextured:
vis2::GeometricObject vis2::DrawableObject vis2::ModelTextured vis2::SpinningCubeTextured

Public Member Functions

 GeometricObjectTextured (glm::mat4 _modelMatrix, Shader *_shader, Texture *_diffuse_texture, const float *_positions_Ptr, const unsigned int _pos_size, const float *_normals_Ptr, const unsigned int _norm_size, const float *_uv_Ptr, const unsigned int _uv_size, const unsigned int *_index_Ptr, const unsigned int _ind_size)
 Constructor. More...
 
virtual ~GeometricObjectTextured ()
 Destructor. More...
 
virtual void update (double _deltaT)=0
 Abstract update function. More...
 
virtual void draw (glm::mat4 &_projectionMatrix)
 Draw function. More...
 
- Public Member Functions inherited from vis2::GeometricObject
 GeometricObject (glm::mat4 _modelMatrix, Shader *_shader, const float *_positions_Ptr, const unsigned int _pos_size, const float *_normals_Ptr, const unsigned int _norm_size, const unsigned int *_index_Ptr, const unsigned int _ind_size)
 Constructor. More...
 
virtual ~GeometricObject ()
 Destructor. More...
 
- Public Member Functions inherited from vis2::DrawableObject
 DrawableObject (glm::mat4 &_modelMatrix)
 Constructor. More...
 
virtual ~DrawableObject ()
 Destructor. More...
 

Protected Attributes

GLuint uv_buffer_handle
 handle to the uv buffer object containing the vertex texture coordinates in object space More...
 
Texturediffuse_texture_Ptr
 handle to the texture for this object More...
 
- Protected Attributes inherited from vis2::GeometricObject
unsigned int index_count
 nr of polygons to be drawn More...
 
GLuint vao_handle
 handle to the vertex attribute object More...
 
GLuint position_buffer_handle
 handle to the vertex buffer object containing the vertex coordinates in object space More...
 
GLuint normal_buffer_handle
 handle to the normal buffer object containing the vertex normals in object space More...
 
GLuint index_buffer_handle
 handle to the vertex buffer object containing the face indices for each polygon More...
 
Shadershader_Ptr
 is a pointer to the shader this object uses More...
 
- Protected Attributes inherited from vis2::DrawableObject
glm::mat4 modelMatrix
 holds the current model matrix More...
 

Private Member Functions

 GeometricObjectTextured (const GeometricObjectTextured &)
 Hidden copy-constructor. More...
 

Detailed Description

This is the base class for all objects that require both geometry and a texture to be drawn by OpenGL.

An abstract interface for ensuring all textured geometric objects contain positions, normals and
texture coordiate arrays, a face index array, and at least one texture.

Definition at line 15 of file GeometricObjectTextured.h.

Constructor & Destructor Documentation

GeometricObjectTextured::GeometricObjectTextured ( glm::mat4  _modelMatrix,
Shader _shader,
Texture _diffuse_texture,
const float *  _positions_Ptr,
const unsigned int  _pos_size,
const float *  _normals_Ptr,
const unsigned int  _norm_size,
const float *  _uv_Ptr,
const unsigned int  _uv_size,
const unsigned int *  _index_Ptr,
const unsigned int  _ind_size 
)

Constructor.

In addition to the Vertex Buffer Objects (VBO) built by the parent constructor this
constructor builds a VBO of out of the input texture coordinate array
and attaches it to the Vertex Attribute Object (VAO).

Parameters
[in]_modelMatrixis the model matrix that places the object in the world coordinate system,
[in]_shaderis the shader program used by this object,
[in]_diffuse_textureis the pointer to a texture object,
[in]_positions_Ptris a pointer to the vertex positions array,
[in]_pos_sizeis is the size of the vertex positions array,
[in]_normals_Ptris a pointer to the vertex normals array,
[in]_norm_sizeis the size of the vertex normals array,
[in]_uv_Ptris a pointer to the texture coordinates array,
[in]_uv_sizeis the size of the texture coordinates array,
[in]_index_Ptris a pointer to the face index array,
[in]_ind_sizeis the size of the face index array.

Definition at line 6 of file GeometricObjectTextured.cpp.

GeometricObjectTextured::~GeometricObjectTextured ( )
virtual

Destructor.

Deletes the VBOs and the VAO built in the constructor.

Definition at line 50 of file GeometricObjectTextured.cpp.

vis2::GeometricObjectTextured::GeometricObjectTextured ( const GeometricObjectTextured )
private

Hidden copy-constructor.

Member Function Documentation

void GeometricObjectTextured::draw ( glm::mat4 &  _projectionMatrix)
virtual

Draw function.

This function activates the shader program, passes the updates to the shader uniform variables,
binds the texture and passes it to the shader,
binds the Vertex Attribute Object (VAO), makes a draw call, then unbinds the VAO and the shader program.

Parameters
[in]_projectionMatrixpasses the combined view and projection matrices.

Reimplemented from vis2::GeometricObject.

Reimplemented in vis2::ModelTextured, and vis2::SpinningCubeTextured.

Definition at line 59 of file GeometricObjectTextured.cpp.

virtual void vis2::GeometricObjectTextured::update ( double  _deltaT)
pure virtual

Abstract update function.

Implements vis2::GeometricObject.

Implemented in vis2::ModelTextured, and vis2::SpinningCubeTextured.

Member Data Documentation

Texture* vis2::GeometricObjectTextured::diffuse_texture_Ptr
protected

handle to the texture for this object

Definition at line 64 of file GeometricObjectTextured.h.

GLuint vis2::GeometricObjectTextured::uv_buffer_handle
protected

handle to the uv buffer object containing the vertex texture coordinates in object space

Definition at line 63 of file GeometricObjectTextured.h.


The documentation for this class was generated from the following files: