OpenGL: Use OpenGLCommandList instead of raw GL in minimal test
- Replace glViewport() with commandList.SetViewport() - Replace glClearColor()+glClear() with commandList.Clear() - Add OpenGLCommandList include and instance
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLDevice.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLSwapChain.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLCommandList.h"
|
||||
#include "XCEngine/Debug/Logger.h"
|
||||
#include "XCEngine/Debug/ConsoleLogSink.h"
|
||||
#include "XCEngine/Containers/String.h"
|
||||
@@ -135,6 +136,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
OpenGLSwapChain swapChain;
|
||||
swapChain.Initialize(hwnd, gWidth, gHeight);
|
||||
|
||||
// Create command list for rendering commands
|
||||
OpenGLCommandList commandList;
|
||||
|
||||
// Main render loop
|
||||
MSG msg = {};
|
||||
int frameCount = 0;
|
||||
@@ -148,10 +152,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
} else {
|
||||
// Set viewport and clear color for each frame
|
||||
glViewport(0, 0, gWidth, gHeight);
|
||||
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Set viewport and clear color using encapsulated command list
|
||||
commandList.SetViewport(0, 0, gWidth, gHeight);
|
||||
commandList.Clear(1.0f, 0.0f, 0.0f, 1.0f, 1 | 2);
|
||||
|
||||
// Present the rendered frame
|
||||
swapChain.Present(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user