55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#include "Archimedes.h"
|
|
|
|
#include "modules/WindowModule/WindowModule.h"
|
|
|
|
class TestTriangle : public Archimedes::Module {
|
|
|
|
public:
|
|
TestTriangle(Archimedes::App*, void*);
|
|
|
|
TestTriangle() { name = "TestTriangle"; }
|
|
|
|
~TestTriangle();
|
|
|
|
void onLoad();
|
|
|
|
void run();
|
|
|
|
|
|
private:
|
|
|
|
Archimedes::Window* window;
|
|
|
|
std::list<std::function<void()>>::iterator rcmd_it;
|
|
|
|
float vertices[3 * 3] = {
|
|
0.5, 0.5, 0.0,
|
|
0.5, 0.5, 0.0,
|
|
0.0, 0.5, 0.0
|
|
};
|
|
|
|
unsigned int vao, vbo, vs, fs, program;
|
|
int success;
|
|
|
|
const char *vertexShaderSource =
|
|
"#version 330 core\n"
|
|
"layout (location = 0) in vec3 aPos;\n"
|
|
"void main() {\n"
|
|
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
|
|
"}\0";
|
|
|
|
const char *fragShaderSource =
|
|
"#version 330 core\n"
|
|
"out vec4 FragColor;\n"
|
|
"void main() {\n"
|
|
" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
|
|
"}\0";
|
|
|
|
|
|
};
|
|
|
|
#ifdef TESTTRIANGLE_DYNAMIC
|
|
typedef TestTriangle mtype;
|
|
#include "endModule.h"
|
|
#endif
|