2016-09-13 19:03:36 +00:00
|
|
|
#include <include/opengl.h>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
class MainWindow : public endofthejedi::GLWindow {
|
|
|
|
private:
|
|
|
|
protected:
|
|
|
|
void init() override {
|
|
|
|
glClearColor(0.5f, 0.6f, 0.7f, 1.0f);
|
|
|
|
resize();
|
|
|
|
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
}
|
|
|
|
void render(double time) override {
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
glColor3f(1.0f, 0.0f, 0.0f);
|
|
|
|
glVertex3f(0.0f, -1.0f, 0.0f);
|
|
|
|
glColor3f(0.0f, 1.0f, 0.0f);
|
|
|
|
glVertex3f(-1.0f, 1.0f, 0.0f);
|
|
|
|
glColor3f(0.0f, 0.0f, 1.0f);
|
|
|
|
glVertex3f(1.0f, 1.0f, 0.0f);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
void resize() override { glViewport(0, 0, getwidth(), getheight()); }
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainWindow(unsigned int width, unsigned int height)
|
|
|
|
: endofthejedi::GLWindow(width, height) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
|
|
MainWindow window(500, 500);
|
2016-09-14 03:22:10 +00:00
|
|
|
window.set_maxfps(60.0);
|
2016-09-13 19:03:36 +00:00
|
|
|
window.loop();
|
|
|
|
window.stop();
|
|
|
|
}
|