add triangle test

This commit is contained in:
2026-02-04 08:35:16 -06:00
parent 78a8c9bf95
commit 43d950b035
3 changed files with 136 additions and 20 deletions

View File

@@ -0,0 +1,54 @@
#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