add create vertex buffer for a triangle

This commit is contained in:
2025-09-10 11:27:40 +02:00
parent 417b951112
commit 9a0c9a50ea
7 changed files with 69 additions and 13 deletions
+2 -11
View File
@@ -1,6 +1,5 @@
#include "Direct3D.h"
#include "Utilities.h"
#include <random>
INT Direct3D::init(HWND hWnd, UINT width, UINT height, BOOL isFullscreen)
{
@@ -49,23 +48,15 @@ INT Direct3D::init(HWND hWnd, UINT width, UINT height, BOOL isFullscreen)
return 0;
}
void Direct3D::beginScene()
void Direct3D::beginScene(BYTE red, BYTE green, BYTE blue)
{
_pD3DDevice->BeginScene(); // init a frame, after this call we are allowed to do draw calls
// change background color
static std::default_random_engine e;
static std::uniform_int_distribution<int> d(0, 255);
_pD3DDevice->Clear(
0, nullptr, // areas to clear, null -> everything
D3DCLEAR_TARGET, // what to clear, bitmask
// how to clean
//D3DCOLOR_XRGB(d(e), d(e), d(e)), //random color
//D3DCOLOR_XRGB(255, 0, 0), // red color
D3DCOLOR_XRGB(0, 0, 0), // black color
1.0f, 0xFFFFFFFF
D3DCOLOR_XRGB(red, green, blue), 1.0f, 0xFFFFFFFF // how to clean
);
}