Thareh Posted March 30, 2010 Share Posted March 30, 2010 Hi! Since I didn't get any answers on my previous topic (LINK) and I've been stuck on this for several days, I'm posting under the General Discussion instead. And the questions are probably more aimed to Josh since no one have been able to answer. 1. Since it's not recommended to use buffers smaller than 64x64, how would I go ahead and create a texture smaller than 64x64 and render to it? (I used buffers before) 2. Is it possible to clear a buffer so that it's transparent instead of white? And if so: how? Thanks. Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Canardia Posted March 30, 2010 Share Posted March 30, 2010 1. Not recommended probably means it won't run on all cards, but nothing runs on all cards anyway. You could check if the card support smaller than 64x64 textures, and if not, then just render it on a 64x64 texture and scale the image smaller on screen. 2. Transparency works with any color, you just need to set the alpha value. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Thareh Posted March 30, 2010 Author Share Posted March 30, 2010 Okey, Thanks Lumooja. But the problem with using buffer smaller than 64x64 is this: LINK. Any way to solve this? I've tried clearing the buffer with the alpha set to 0, but it still won't be transparent. Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Josh Posted March 30, 2010 Share Posted March 30, 2010 The error that is thrown is an OpenGL error. A 2x2 buffer might be okay. A 2x1 buffer is apparently not. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thareh Posted March 30, 2010 Author Share Posted March 30, 2010 Okiedokie, Thanks Josh. What about the transparency issue then? I just can't get a buffer to be cleared into "nothing"/transparency. Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Josh Posted March 30, 2010 Share Posted March 30, 2010 How can a buffer be transparent? What would it look like? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thareh Posted March 30, 2010 Author Share Posted March 30, 2010 Since I'm using buffers to do a Render to Texture routine it would be like masked, if you create an image in Photoshop with a transparent background and then you can paint whatever you want on it, and the areas you haven't touched will be transparent Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Canardia Posted March 30, 2010 Share Posted March 30, 2010 Just set the alpha value of the color to 0. You need also to SetBlend(BLEND_ALPHA), else transparency is not used with DrawImage. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Josh Posted March 30, 2010 Share Posted March 30, 2010 Clear the buffer with any color, using 0 for the alpha component. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thareh Posted March 30, 2010 Author Share Posted March 30, 2010 I've tried that already, Doesn't seem to do the trick! :S Local Buffer:TBuffer = CreateBuffer( W, H, BUFFER_COLOR ) SetBuffer( Buffer ) SetColor( Vec4( 1, 1, 1, 0 ) ) ClearBuffer() SetColor( Vec4( 1 ) ) SetColor( Vec4( 1, 1, 1, 0 ) ) Local Buffer:TBuffer = CreateBuffer( W, H, BUFFER_COLOR ) SetBuffer( Buffer ) ClearBuffer() SetColor( Vec4( 1 ) ) Tried both of these without any change Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Josh Posted March 30, 2010 Share Posted March 30, 2010 How would you tell any change? Where is your code that displays the result? I use this approach for rendering billboard textures. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thareh Posted March 30, 2010 Author Share Posted March 30, 2010 Gah, Found the problem. Was on my end all along Thanks for the quick response now! I got it all solved! Quote Core2Duo, 3.33GHz, Radeon HD 5850 Black Edition, 4GB RAM, 4 TB HDD, Windows 7. Core2Duo, 2.00GHz, Geforce 9500m, 4GB RAM, 320 GB HDD, Windows 7. Link to comment Share on other sites More sharing options...
Josh Posted March 31, 2010 Share Posted March 31, 2010 Great! Quote My job is to make tools you love, with the features you want, and performance you can't live without. 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.