bandrewk Posted January 2, 2014 Share Posted January 2, 2014 Hello, I am experiencing a problem when drawing a small image in-game: It is showing correctly in the editor, however, when I draw it in-game it looks awful. Drawing code (Context blend mode is set to alpha): Context::GetCurrent()->DrawImage(textureGrab, Window::GetCurrent()->GetWidth() / 2, Window::GetCurrent()->GetHeight() / 2); What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 2, 2014 Share Posted January 2, 2014 is it drawn with a different ratio? Quote Link to comment Share on other sites More sharing options...
bandrewk Posted January 2, 2014 Author Share Posted January 2, 2014 I am not modifying it in any way. It is being loaded and directly drawn with the code above. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 2, 2014 Share Posted January 2, 2014 It looks like either blend isn't set properly or that the image draws over itself so much that the blend negates and everything is just full white. Try putting Context::GetCurrent()->Clear(); before drawing the image to see what happens. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 2, 2014 Share Posted January 2, 2014 I can't see your image here at work, but gamecreator says it's full white. I have this same issue, however it changes while I'm moving (mine is crosshairs for the player). In a project I have I am able to move around and in certain situations my crosshair model turns pure white, while in other situations it's normal. The map for this project is corrupt and I hope Josh is looking at fixing that so this bug can be reviewed. Quote Link to comment Share on other sites More sharing options...
bandrewk Posted January 2, 2014 Author Share Posted January 2, 2014 Okay guys, thank you. I found a solution. Adding Context::GetCurrent()->SetColor(1, 1, 1, 1); before drawing the image did the trick: Seems a bit hacky but it's working. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 2, 2014 Share Posted January 2, 2014 Nice. I do that in my code too but only because I set transparencies so I guess that automatically took care of that potential problem. Do you have to do it every frame or just once before you enter the loop? I'm also curious about what GetColor returns without it but not a big deal. SetColor probably does something undocumented in the function that properly sets blend. Quote Link to comment Share on other sites More sharing options...
bandrewk Posted January 3, 2014 Author Share Posted January 3, 2014 I made a mistake. GetColor() returned 255, 255, 255, 255. I had a line of code somewhere that said context->SetColor(255, 255, 255, 255); After changing it to 1,1,1,1 it worked just fine. Thank you gamecreator! Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 3, 2014 Share Posted January 3, 2014 Ha, that definitely makes more sense. Glad you found that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.