Example #1
0
void render(void)
{
    int i;

    /* Clear backbuffer with black color */
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    apply_camera(cam);

  
    for(i = 0; i < riCount; i++)
    {
        /* Get position og current triangle in buffer */
        int index = 3 * i;

        /* Get vertex indices of triangle vertices */
        int a = 3 * riBuffer[index];
        int b = 3 * riBuffer[index + 1];
        int c = 3 * riBuffer[index + 2];


        /* Render wireframe model */
        glBegin(GL_LINE_LOOP);
        glColor3f(1.0, 1.0, 1.0);
        glVertex3f(rvBuffer[a], rvBuffer[a + 1], rvBuffer[a + 2]);
        glVertex3f(rvBuffer[b], rvBuffer[b + 1], rvBuffer[b + 2]);
        glVertex3f(rvBuffer[c], rvBuffer[c + 1], rvBuffer[c + 2]);
        glEnd();
    }
    
    /* Call backbuffer and replace screen contends */
    glutSwapBuffers();
}
Example #2
0
void C3DPlotCanvas::begin_redraw()
{
    apply_camera();
    ball->apply_transform();
}