Computergrafik
Qt / LGL Programming Template
← LGL API | ● | Matrix Transformationen →
#include <glvertex_qt_glui.h>
class Qt_GLWindow: public lgl_Qt_GLUI
{
public:
Qt_GLWindow() : lgl_Qt_GLUI()
{
// put initializations here (no OpenGL context available yet):
// ...
}
protected:
void initializeOpenGL()
{
// put OpenGL initializations here (OpenGL context hase been created):
// ...
//
// for example:
//
// lglClearColor(1,1,1);
}
void renderOpenGL(double dt)
{
// clear frame buffer
lglClear();
// just show a greeting in the beginning
lglDrawString(1, "Hello, OpenGL!");
// put OpenGL rendering commands here:
// ...
//
// for example:
//
// lglBegin(LGL_LINES);
// lglVertex(-1,-1,0);
// lglVertex(1,1,0);
// lglEnd();
}
void keyPressed(char key)
{
// put key checks here:
// ...
//
// for example:
//
// if (key == 'q')
// exit(0);
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Qt_GLWindow main;
main.show();
return(app.exec());
}
class Qt_GLWindow: public lgl_Qt_GLUI
{
public:
Qt_GLWindow() : lgl_Qt_GLUI()
{
// put initializations here (no OpenGL context available yet):
// ...
}
protected:
void initializeOpenGL()
{
// put OpenGL initializations here (OpenGL context hase been created):
// ...
//
// for example:
//
// lglClearColor(1,1,1);
}
void renderOpenGL(double dt)
{
// clear frame buffer
lglClear();
// just show a greeting in the beginning
lglDrawString(1, "Hello, OpenGL!");
// put OpenGL rendering commands here:
// ...
//
// for example:
//
// lglBegin(LGL_LINES);
// lglVertex(-1,-1,0);
// lglVertex(1,1,0);
// lglEnd();
}
void keyPressed(char key)
{
// put key checks here:
// ...
//
// for example:
//
// if (key == 'q')
// exit(0);
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Qt_GLWindow main;
main.show();
return(app.exec());
}
← LGL API | ● | Matrix Transformationen →