OpenGL: Add minimal integration test and enable integration test framework
- Add OpenGL_Minimal integration test using Win32 native API + glad - Copy run_integration_test.py and compare_ppm.py from D3D12 - Create minimal/main.cpp with red clear color (matching D3D12) - Generate GT.ppm golden template for 1280x720 red window - Add VertexArray_Bind_MultipleAttributes unit test - Update integration/CMakeLists.txt to build OpenGL_Minimal target
This commit is contained in:
@@ -68,3 +68,48 @@ TEST_F(OpenGLTestFixture, VertexArray_Bind_Unbind) {
|
||||
|
||||
vao.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, VertexArray_Bind_MultipleAttributes) {
|
||||
OpenGLVertexArray vao;
|
||||
vao.Initialize();
|
||||
|
||||
OpenGLBuffer buffer1;
|
||||
float positions[] = { 0.0f, 0.0f, 0.5f, 0.5f };
|
||||
buffer1.InitializeVertexBuffer(positions, sizeof(positions));
|
||||
|
||||
OpenGLBuffer buffer2;
|
||||
float colors[] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||
buffer2.InitializeVertexBuffer(colors, sizeof(colors));
|
||||
|
||||
VertexAttribute attrPos;
|
||||
attrPos.index = 0;
|
||||
attrPos.count = 2;
|
||||
attrPos.type = GL_FLOAT;
|
||||
attrPos.normalized = false;
|
||||
attrPos.stride = sizeof(float) * 2;
|
||||
attrPos.offset = 0;
|
||||
|
||||
VertexAttribute attrColor;
|
||||
attrColor.index = 1;
|
||||
attrColor.count = 4;
|
||||
attrColor.type = GL_FLOAT;
|
||||
attrColor.normalized = false;
|
||||
attrColor.stride = sizeof(float) * 4;
|
||||
attrColor.offset = 0;
|
||||
|
||||
vao.AddVertexBuffer(buffer1.GetID(), attrPos);
|
||||
vao.AddVertexBuffer(buffer2.GetID(), attrColor);
|
||||
|
||||
vao.Bind();
|
||||
GLint boundVAO = 0;
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVAO);
|
||||
EXPECT_EQ(boundVAO, static_cast<GLint>(vao.GetID()));
|
||||
|
||||
vao.Unbind();
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVAO);
|
||||
EXPECT_EQ(boundVAO, 0);
|
||||
|
||||
buffer1.Shutdown();
|
||||
buffer2.Shutdown();
|
||||
vao.Shutdown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user