# Direct2D Bitmap Always Painting Yellow

This topic is 2733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

The following code is painted to my screen at the correct destination but the completely wrong color. I have tried adding things to renTarget etc. but it always paints as a bright yellow color. For simplicity, I just showed the current code I have now. Clearly, I cleared the screen to black but it still paints as yellow on my application. Any idea why? (Considering the destination is exactly where I want it, x/y/width/height are all correct variables).

ID2D1Bitmap *bmap = NULL;D2D1_RECT_F destination = D2D1::RectF(x,y,x+width,y+height);D2D1_RECT_F all = D2D1::RectF(0,0,width,height);ID2D1BitmapRenderTarget *renTarget = NULL;HRESULT hr = target->CreateCompatibleRenderTarget(D2D1::SizeF(width, height),&renTarget);if(SUCCEEDED(hr)){	renTarget->Clear(D2D1::ColorF(0.0f,0.0f,0.0f,1.0f));	HRESULT hr = renTarget->GetBitmap(&bmap);	if(SUCCEEDED(hr))	{		// This always succeeds.	}}renTarget->Release();target->DrawBitmap(bmap,destination,1.0f,D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,all); // This always draws plain yellow box?// It draws it at the correct destination but is a bright color yellow, even though my clear should have made the entire thing black?

God I am dumb, for some reason I didn't realize that I needed to also begindraw() / enddraw() for this particular render target. Sigh.

[Edited by - fmwyso on August 29, 2010 2:39:03 PM]