pawelzaborek Posted November 22, 2015 Share Posted November 22, 2015 Hello, after searching through the internet without finding a solution, I decided to join leadwerks forum. My problem is such, that I wanted to create a 2D button on the screen using context:DrawImage(), however when the camera in game is near a low angle (looking at the horizon), the button becomes semi-transparent: one can see the 3D scene through the black letters, whereas the white background covers the scene a little. This effect disappears if the camera in game is brought back up. I only have one context, by the surprising name of 'context'... --Render the world world:Render() context:DrawImage(A1, 0, 0, 400, 370) --(A1 refers to a loaded ".tex" file, with DXT1) --Refresh the screen context:Sync() --Vsync is off I'm not particularly interested in third-party GUI systems, since this is only my first project. Does anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
shadmar Posted November 23, 2015 Share Posted November 23, 2015 You should set the context blendmode to Blend.Alpha prior to drawing the button. 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
pawelzaborek Posted November 23, 2015 Author Share Posted November 23, 2015 Hi shadmar, thank you very much, that was a very quick fix! Would you be so kind to explain how this 'blend mode' thing works, and what the different blend modes do, please? Quote Link to comment Share on other sites More sharing options...
programmed_sheep Posted December 3, 2015 Share Posted December 3, 2015 Basically, blend modes add effects to images and change how they are rendered on the screen. I cannot vouch for what the different blend modes do in the engine (since I haven't used them yet), but the most common ones are 1) A "Pixel-perfect" blend mode (doesn't add any smoothing effects; image will look exactly like it does when you make it) 2) A Smoothing blend mode (makes approximations based on nearby pixels and "smooths" the image to decrease pixelation) and 3) An alpha-based blending effect (takes the alpha channel from the image (0-1 or 0-255 depending on format) and applies it to the rendered image. There are probably more in the engine (and most definitely named differently), but those are the main three I have seen across several applications. Hope this helps -- First post on the forum Quote i5 4690k | EVGA 780 Ti | Linux 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.