Skip to content

Commit

Permalink
Merge pull request #77 from enen92/black_screen
Browse files Browse the repository at this point in the history
Windows: Clear color (black background)
  • Loading branch information
enen92 authored Oct 28, 2024
2 parents 405bb3a + 067b6ae commit 62ca131
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,17 @@ void CRenderD3D::Begin(void)
#endif
}

void CRenderD3D::ClearColor()
{
#ifdef WIN32
ID3D11RenderTargetView* renderTargetView;
m_pContext->OMGetRenderTargets(1, &renderTargetView, nullptr);
float clearColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
m_pContext->ClearRenderTargetView(renderTargetView, clearColor);
SAFE_RELEASE(renderTargetView);
#endif
}

void CRenderD3D::DrawQuad(TRenderVertex* verts)
{
#ifdef WIN32
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CRenderD3D
{
public:
void Init(void* pContext);
void ClearColor();
void DrawQuad(TRenderVertex* verts);
void Begin(void);
void Release(void);
Expand Down
1 change: 1 addition & 0 deletions src/pingpong.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ bool CPingPong::Draw(CRenderD3D* render)

DisableShader();
#else
render->ClearColor();
render->DrawQuad(&vert[0]);
render->DrawQuad(&vert[4]);
render->DrawQuad(&vert[8]);
Expand Down

0 comments on commit 62ca131

Please sign in to comment.