Example #1
0
void Render::paintGL() {
    glClear(GL_COLOR_BUFFER_BIT);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDisable(GL_DEPTH_TEST);
    glDepthMask(GL_FALSE);
    move();
    drawGrid();
    drawCar();
    drawSparks();
    drawBody(world->getTrack()->getBody());
    drawText();
    drawParents();
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    glOrtho(0, width(), height(), 0, 1.0, -1.0);
    drawTable();
    drawGraph();
    glPopMatrix(); //GL_MODELVIEW
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
}
/************************************************************************

	Function:		buttonLogic

	Description: This performs button logic depending on if a button is
	pressed or not. Does not contain all logic for buttons, as some is
	contained in the method called by the button press.

*************************************************************************/
void buttonLogic(void) {
	if(sparkleButtonPressed) {
		// Draw the spinning sparkle that traces the N and star
		drawSparkle();
	}

	if(sparksButtonPresssed) {
		// Draw Sparks only if sparkle button is pressed
		if(sparkleButtonPressed) {
			drawSparks();
		}
	}
}