Jump to content

Recommended Posts

Posted

Hello,

 

I am experiencing a problem when drawing a small image in-game:

 

wvz98h.png

 

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?

Posted

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.

Posted

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.

Posted

Okay guys, thank you. I found a solution.

 

Adding

Context::GetCurrent()->SetColor(1, 1, 1, 1);

before drawing the image did the trick:

 

5cgf1l.png

 

Seems a bit hacky but it's working.

Posted

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.

Posted

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. rolleyes.gif Thank you gamecreator!

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...