add triangle test
This commit is contained in:
54
modules/Archimedes-Modules/TestTriangle/TestTriangle.h
Normal file
54
modules/Archimedes-Modules/TestTriangle/TestTriangle.h
Normal 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
|
||||
Reference in New Issue
Block a user