1
Direct2D를 사용하여 직사각형을 그려 봅니다.ID2D1DeviceContext EndDraw 드로잉 직사각형 후 D2DERR_WRONG_STATE
HRESULT result;
result = g_d2dContext->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::Blue),
&g_SolidBrush
);
D2D1_RECT_F rect = D2D1::RectF(
g_targetRect.left + 10.0f,
g_targetRect.top + 10.0f,
g_targetRect.right - 10.0f,
g_targetRect.bottom - 10.0f);
g_d2dContext->BeginDraw();
{
g_d2dContext->DrawRectangle(rect, g_SolidBrush, 5.0f);
}
result = g_d2dContext->EndDraw();
if (FAILED(result))
{
OutputDebugStringW(L"The object was not in the correct state to process the method.");
}
EndDraw() 메소드는 다음 HRESULT를 반환 : 0x88990001 (D2DERR_WRONG_STATE) - The object was not in the correct state to process the method
다음과 같이 Direct2D의 장치와 Direct2D의 디바이스 컨텍스트를 초기화하고 다음 MSDN article에 기재된 렌더 타겟들을 설정 한 후, I는 사각형을 그리려고.
사각형이 그려지지 않습니다. 나는 검은 이미지 만 얻는다.
편집 :
나는 문제가가/비트 맵에 NULL 포인터를 얻을 CreateBitmapFromDxgiSurface를 호출 한 후 대상을 렌더링한다는 것을 가정.
g_d2dContext->CreateBitmapFromDxgiSurface(
dxgiBackBuffer.Get(),
&bitmapProperties,
&g_targetBitmap);
g_d2dContext->SetTarget(g_targetBitmap.Get());
왜 targetBitmap이 NULL입니까?
아이디어가 있으십니까?
미리 감사드립니다.