Jump to content
  • Advertisement
Sign in to follow this  

Direct2D Bitmap Always Painting Yellow

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

If you intended to correct an error in the post then please contact us.

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);
HRESULT hr = renTarget->GetBitmap(&bmap);
// This always succeeds.

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]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!