SourceForge.net Logo

The squrf specific bits of code for you to cut and paste if your feeling lazy.

Include the squrf headers

#include < squrf/squrf.h>
Use the squrf namespace (alternatively, precide all squrf types with 'squrf::')
using namespace squrf;
Create a field
FieldSphere sphere;
Create a tile
Tile tile;
tile.Generate(&sphere, 0, 0, 0, 10, 10, 10, 1.0f);
Setup the tile arrays for GL
glNormalPointer(   GL_FLOAT, Vertex::Step * sizeof(GLfloat), tile.Normals());
glVertexPointer(3, GL_FLOAT, Vertex::Step * sizeof(GLfloat), tile.Vertices());
Render the tile
glDrawRangeElements(GL_TRIANGLES, 0, tile.NumVertices(), tile.NumIndices(), GL_UNSIGNED_SHORT, tile.Indices());