Download ParCompMark User Manual

Transcript
108
// Define our requirements
const char *Renderer::mNeededLibs[] = {"libm", "libGL", "libGLU", 0};
const char *Renderer::mNeededOpenGLExts[] = {"GL_EXT_texture3D", 0};
Renderer::Renderer(Display *display, Window window, XVisualInfo *visualInfo,
GLXContext glxContext) {
}
Renderer::~Renderer() throw (Exception) {
}
void Renderer::onLoad() throw (Exception) {
}
void Renderer::onUnload() throw (Exception) {
}
void Renderer::setMiscParam(const char *name, const char *value) throw (
Exception) {
// By default, do nothing just push the parameter
mMiscParams[name] = value;
}
void Renderer::setObjectSpaceBoundingBox (double x0, double y0, double z0,
double x1, double y1, double z1) throw (Exception) {
}
void Renderer::setObjectId(unsigned id) throw (Exception) {
}
void Renderer::setScreenSpaceFramelet (double u0, double v0, double u1, double
v1) throw (Exception) {
}
void Renderer::onResize(unsigned width, unsigned height) throw (Exception) {
}
void Renderer::onRender(double time, unsigned frame) throw (Exception) {
// Create time based color values
double s = 0.5*sin(time)+0.5;
double c = 0.5*cos(time)+0.5;
if(mMiscParams["invColours"] == "yes") {
glBegin(GL_TRIANGLES);
glColor3f(c, 0.0, 0.0);
glVertex2f(5.0,
glColor3f(0.0, s, 0.0);
glVertex2f(0.0,
glColor3f(0.0, 0.0, c);
glVertex2f(0.0,
glEnd();
}
else {
glBegin(GL_TRIANGLES);
glColor3f(s, 0.0, 0.0);
glVertex2f(5.0,
glColor3f(0.0, c, 0.0);
glVertex2f(0.0,
glColor3f(0.0, 0.0, s);
glVertex2f(0.0,
glEnd();
}
0.0);
0.0);
5.0);
0.0);
0.0);
5.0);
}
Listing D.4: renderer.cpp sample