Thareh Posted May 5, 2010 Share Posted May 5, 2010 Hi! What's the best way to convert a buffer to a texture? The only way I know of is using GetColorBuffer, but that also links the buffer to the texture and therefore doesn't fit my purpose. Thanks Oh and I'm posting here because I didn't get much response on my other thread. 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 May 5, 2010 Share Posted May 5, 2010 You can use CopyBuffer(GetColorBuffer(),BUFFER_COLOR) to get only the texture which is not linked to the original buffer. 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 May 5, 2010 Author Share Posted May 5, 2010 Thank you, I'm aware of that but I don't want any linking with any buffers. I'm not sure they're freed correctly when linked to a texture, my program crashes after x amount of GetColorBuffers. 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 May 5, 2010 Share Posted May 5, 2010 You should always free the buffer yourself and not wait for the engine to do it. 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 May 5, 2010 Author Share Posted May 5, 2010 There's no FreeBuffer command in BlitzMax, I'm just using Buffer = Null. 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 May 5, 2010 Share Posted May 5, 2010 I'm not sure what FreeBuffer() does, but I would assume it also sets the buffer to null and then calls garbage collection to make sure it's released immediately and not at some random point which will make your program crash. 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 May 5, 2010 Author Share Posted May 5, 2010 Even if I can get it freed correctly I'd still prefer a way without having to copy the buffer. Creating a buffer or doing GetColorBuffer is pretty slow, my program freezes like 250ms on my Laptop when I call them. (Which is not good since I use A LOT of both of these commands for my Render to Texture interface) 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...
Thareh Posted May 6, 2010 Author Share Posted May 6, 2010 I think I've got the buffers to free correctly now! But still the performance on using CreateBuffer and GetColorBuffer to do a 'Render to Texture' routine is very poor :/ There must be a better way of doing this! >.< 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...
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.