fix: encapsulate OpenGL types in VertexAttribute to eliminate raw GL API usage in tests

- Add VertexAttributeType and VertexAttributeNormalized enums in OpenGLVertexArray.h
- Add ToGLAttributeType() converter in OpenGLVertexArray.cpp
- Remove glActiveTexture() call from quad test (already handled by texture.Bind())
- Remove #include <glad/glad.h> from triangle test
- Update unit tests to use encapsulated enums

All three OpenGL integration tests (minimal, triangle, quad) pass with 0% pixel difference.
This commit is contained in:
2026-03-22 14:33:57 +08:00
parent 1f129ed20f
commit 1797e7fe17
10 changed files with 61 additions and 112 deletions

View File

@@ -5,8 +5,6 @@
#include <windows.h>
#include <glad/glad.h>
#include "XCEngine/RHI/OpenGL/OpenGLDevice.h"
#include "XCEngine/RHI/OpenGL/OpenGLSwapChain.h"
#include "XCEngine/RHI/OpenGL/OpenGLCommandList.h"
@@ -124,8 +122,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
VertexAttribute posAttr = {};
posAttr.index = 0;
posAttr.count = 4;
posAttr.type = GL_FLOAT;
posAttr.normalized = GL_FALSE;
posAttr.type = VertexAttributeType::Float;
posAttr.normalized = VertexAttributeNormalized::False;
posAttr.stride = sizeof(Vertex);
posAttr.offset = 0;
vertexArray.AddVertexBuffer(vertexBuffer.GetID(), posAttr);
@@ -133,8 +131,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
VertexAttribute colAttr = {};
colAttr.index = 1;
colAttr.count = 4;
colAttr.type = GL_FLOAT;
colAttr.normalized = GL_FALSE;
colAttr.type = VertexAttributeType::Float;
colAttr.normalized = VertexAttributeNormalized::False;
colAttr.stride = sizeof(Vertex);
colAttr.offset = sizeof(float) * 4;
vertexArray.AddVertexBuffer(vertexBuffer.GetID(), colAttr);