blShapeCylinder and blShapeSphere — Construct and render static or dynamic conical and spherical surfaces in opengl

This entry is part 4 of 6 in the series blShapeAPI -- BarbatoLabs Shape API

Introduction

As part of the blShapeAPI series, in this article I present blShapeCylinder and blShapeSphere, which are derived from blShapeQuadric and build conical and spherical surfaces. Just like blShapeQuadric, these shapes can be static or dynamic, and with only a few lines of code can produce astonishing results.

Dependencies

blShapeCylinder is derived from blShapeQuadric

blShapeSphere is also derived from blShapeQuadric

The code

My code uses inline documentation and follows a clean structure, (at least to me). The blShapeCylinder class is saved in a file called blShapeCylinder.hpp as follows:

blShapeCylinder.hpp (Click to see code…)

The blShapeSphere class is saved in a file called blShapeSphere.hpp as follows:

blShapeSphere.hpp

Usage

Very soon, I will post examples on how to use the blShapeAPI and all of its derived shapes

Downloads

I have put all the files into a zip file which can be downloaded here. All you have to do is extract it somewhere, let’s say in a directory called blShapeAPI, and then include the blShapeAPI.hpp file as follows:

#include "blShapeAPI/blShapeAPI.hpp"
using namespace blShapeAPI;

Note: The blShapeAPI depends on the blMathAPI and thus you’ll need both APIs:
blMathAPI.zip Ver 02/22/2011 2:50am (1724) blShapeAPI.zip Ver 11/27/2010 11:40PM (1206)

You’ll also need the GLext.zip (1877) file to use the opengl extensions

About Vincenzo Barbato

Known to his friends as Enzo, he's an outside-the-box engineer/researcher whose interests and expertise span many fields, including controls systems, multi-physics simulations, mechatronics, oil technologies, data analysis and machine vision just to name a few.

Refusing to grow up, he's on a continuous journey to develop simple and creative solutions that have the power of disrupting industries by optimizing systems and processes.

Married to a beautiful wife, with two beautiful daughters and two identical twin boys, his home is a never ending chaotic fountain of inspiration.

His outlook on life:

"Never blindly accept what you're told, listen, but then question, with curiosity, creativity and collaboration we can change the world"

About Enzo

Known to his friends as Enzo, he's an outside-the-box engineer/researcher whose interests and expertise span many fields, including controls systems, multi-physics simulations, mechatronics, oil technologies, data analysis and machine vision just to name a few. Refusing to grow up, he's on a continuous journey to develop simple and creative solutions that have the power of disrupting industries by optimizing systems and processes. Married to a beautiful wife, with two beautiful daughters and two identical twin boys, his home is a never ending chaotic fountain of inspiration. His outlook on life: "Never blindly accept what you're told, listen, but then question, with curiosity, creativity and collaboration we can change the world"

Leave a Reply

Your email address will not be published. Required fields are marked *