This commit is contained in:
2026-01-20 09:17:10 -06:00
parent bdf18fffd3
commit 12dade2ef6
13 changed files with 207 additions and 135 deletions

View File

@@ -9,9 +9,9 @@
using namespace Dawn;
MeshVertex vertices[3] = {
{ Color4B::RED, glm::vec2(0.0f, 0.0f), glm::vec3(-0.5f, -0.5f, 0.0f) },
{ Color4B::GREEN, glm::vec2(1.0f, 0.0f), glm::vec3(0.5f, -0.5f, 0.0f) },
{ Color4B::BLUE, glm::vec2(0.5f, 1.0f), glm::vec3(0.0f, 0.5f, 0.0f) }
{ {255, 0, 0, 255}, glm::vec2(0.5f, 1.0f), glm::vec3(0.0f, 0.5f, 0.0f) },
{ {0, 255, 0, 255}, glm::vec2(0.0f, 0.0f), glm::vec3(-0.5f, -0.5f, 0.0f) },
{ {0, 0, 255, 255}, glm::vec2(1.0f, 0.0f), glm::vec3(0.5f, -0.5f, 0.0f) }
};
Display::Display(Engine &engine) :
@@ -20,8 +20,9 @@ Display::Display(Engine &engine) :
window(nullptr),
#endif
engine(engine),
mesh(3, PrimitiveType::Triangles, vertices)
mesh(3, PrimitiveType::TRIANGLES, vertices)
{
#if DAWN_SDL2
uint32_t flags = SDL_INIT_VIDEO;
#if DAWN_SDL2_GAMEPAD
@@ -104,7 +105,7 @@ void Display::update(void) {
}
}
SDL_GL_MakeCurrent(this->window, this->glContext);
// SDL_GL_MakeCurrent(this->window, this->glContext);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(
@@ -118,6 +119,11 @@ void Display::update(void) {
// glViewport(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT);
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
printf("OpenGL error: %d\n", err);
}
SDL_GL_SwapWindow(this->window);
#endif
}