OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WireframeTorus Class Reference

Class derived from the Torus abstract class. It manages drawing of a rotating wireframed unicolor torus. Apart from inherited components, it manages a buffer that stores indices needed for the glDrawElements() call and also is of determining those indices. As input attributes, it directly passes the vertices of a torus. More...

#include <WireframeTorus.h>

Inheritance diagram for WireframeTorus:
Torus

Public Member Functions

 WireframeTorus (float torusRadius, float circleRadius)
 Instantiates a representation of a solid torus, using user-provided radius and tube radius. More...
 
 ~WireframeTorus (void)
 
void draw (float *rotationVector)
 Draw the torus model. More...
 
- Public Member Functions inherited from Torus
virtual ~Torus (void)
 Frees allocated memory. More...
 
void setProjectionMatrix (MaliSDK::Matrix *projectionMatrix)
 Pass the correctly defined projection matrix to the program related to the torus model. More...
 

Private Member Functions

void initializeBufferForIndices (void)
 Determine indices needed for a single glDrawElements() call in GL_LINES mode. More...
 
bool initializeVertexAttribs (void)
 Initialize vertex attribute arrays and buffer objects coresponding to them. Make sure that programID has been set before this function is called. More...
 

Private Attributes

GLuint indicesBufferID
 

Static Private Attributes

static const unsigned int indicesCount = 4 * circlesCount * pointsPerCircleCount
 

Additional Inherited Members

- Static Public Member Functions inherited from Torus
static void setResourceDirectory (std::string requiredResourceDirectory)
 Set the resource directory for all tori. More...
 
- Protected Member Functions inherited from Torus
 Torus (void)
 Protected constructor used to do intialization general to all torus objects. More...
 
void setColor (float red, float green, float blue, float alpha)
 Sets the uniform color of the drawn torus. More...
 
void setupGraphics (const std::string vertexShaderPath, const std::string fragmentShaderPath)
 Initialize constant OpenGL components such as program, shaders and constant matrices. More...
 
- Protected Attributes inherited from Torus
float torusRadius
 Distance between the center of torus and the center of its tube. More...
 
float circleRadius
 Radius of circles that model the tube. More...
 
GLuint programID
 ID of a program linked to the torus model. More...
 
GLuint vaoID
 ID of a vertex array object that stores pointers to vertex data sources used to rasterize given mesh. More...
 
- Static Protected Attributes inherited from Torus
static std::string resourceDirectory
 
static const unsigned int vertexComponentsCount = 4
 Number of coordinates for one vertex. More...
 
static const unsigned int circlesCount = 12
 Number of circles in torus model. More...
 
static const unsigned int pointsPerCircleCount = 12
 Number of points in one circle. More...
 
static const unsigned int torusVerticesCount = pointsPerCircleCount * circlesCount
 Total number of vertices in torus model. More...
 
static const unsigned int componentsCount = torusVerticesCount * vertexComponentsCount
 Total number of components in torus model, needed to determine the size of vertex arrays. More...
 

Detailed Description

Class derived from the Torus abstract class. It manages drawing of a rotating wireframed unicolor torus. Apart from inherited components, it manages a buffer that stores indices needed for the glDrawElements() call and also is of determining those indices. As input attributes, it directly passes the vertices of a torus.

Definition at line 32 of file WireframeTorus.h.

Constructor & Destructor Documentation

WireframeTorus::WireframeTorus ( float  torusRadius,
float  circleRadius 
)

Instantiates a representation of a solid torus, using user-provided radius and tube radius.

Parameters
torusRadius[in] Distance between the center of torus and the center of its tube.
circleRadius[in] Radius of the circle that models the tube.

Definition at line 35 of file WireframeTorus.cpp.

WireframeTorus::~WireframeTorus ( void  )

Definition at line 60 of file WireframeTorus.cpp.

Member Function Documentation

void WireframeTorus::draw ( float rotationVector)
virtual

Draw the torus model.

Parameters
rotationVectorVector with rotation parameters to be passed to the vertex shader.

Implements Torus.

Definition at line 79 of file WireframeTorus.cpp.

void WireframeTorus::initializeBufferForIndices ( void  )
private

Determine indices needed for a single glDrawElements() call in GL_LINES mode.

Definition at line 65 of file WireframeTorus.cpp.

bool WireframeTorus::initializeVertexAttribs ( void  )
privatevirtual

Initialize vertex attribute arrays and buffer objects coresponding to them. Make sure that programID has been set before this function is called.

Returns
false if error reported, true otherwise.

Implements Torus.

Definition at line 96 of file WireframeTorus.cpp.

Member Data Documentation

GLuint WireframeTorus::indicesBufferID
private

Definition at line 40 of file WireframeTorus.h.

const unsigned int WireframeTorus::indicesCount = 4 * circlesCount * pointsPerCircleCount
staticprivate

Definition at line 37 of file WireframeTorus.h.


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