I've got a rendering class (or the start of one at least) to aid with streamlining and simplifying rendering in my engine.
I would like to use display lists with my vertex operations because of the speed boost that they give, however when I try to use them with my class they fail...
The class is this:
#ifndef RENDERER_H
#define RENDERER_H
#include <SDL_opengl.h>
#include <GL/gl.h>
#include <GL/glu.h>
class Renderer
{
public:
Renderer() {
OutLine = glGenLists(1);
glNewList(OutLine,GL_COMPILE);
glBegin(GL_LINES);
glColor4f(1.0,1.0,1.0,1.0);
for (float x = -5;x<=5;x+=0.1)
{
glVertex3f(x,-5,0.0);
glVertex3f(x,5,0.0);
}
for (float y = -5;y<=5;y+=0.1)
{
glVertex3f(-5,y,0.0);
glVertex3f(5,y,0.0);
}
glVertex3f(-0.05,-0.05,0.0);
glVertex3f(-0.05,0.05,0.0);
glVertex3f(0.05,-0.05,0.0);
glVertex3f(0.05,0.05,0.0);
glVertex3f(-0.05,-0.05,0.0);
glVertex3f(0.05,-0.05,0.0);
glVertex3f(-0.05,0.05,0.0);
glVertex3f(0.05,0.05,0.0);
glEnd();
glEndList();
}
virtual ~Renderer()
{
glDeleteLists(OutLine,1);
}
GLuint OutLine;
void Compile()
{
}
void DrawOutline()
{
glCallList(OutLine);
}
protected:
private:
};
#endif // RENDERER_H
and I render it every frame with:
This code simply displays nothing when called, and gives no compile-time errors either. When I check to see if the GLuint has been initialised as a DL it says that it hasn't, even though I know that it has.
Any thoughts?
Thanks.