Thareh Posted April 15, 2010 Share Posted April 15, 2010 Hi! I'm creating a user interface and I'm using a render to texture routine on all "gadgets" so it'll be faster to draw. When I'm creating a new window there's a 200-300 ms delay, and I've traced this down to the buffer creation or buffer => texture conversion. (I'm using GetColorBuffer to convert) So I'm asking: Are buffers slow or am I doing something wrong? 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...
Thareh Posted April 18, 2010 Author Share Posted April 18, 2010 Here's an example: CLICK ME!. When you create a new window 5 'render to texture' routines happens (Window, Window Panel, Min/max and close button, the label) and this causes a delay. On my laptop the delay is about 400 ms which isn't good enough for me >.< The 'render to texture' routine is just this: Create & Set a new buffer. Draw some stuff using 2d commands. Use GetColorBuffer to get the TTexture. Free the buffer. Is there any faster way of doing 'render to texture' than 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...
ArBuZ Posted April 19, 2010 Share Posted April 19, 2010 Hi! I have almost the same routine, except I create all buffers befor main loop. And then in main loop I only set them and render. Maybe that is your problem. Quote Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64 3ds max / photoshop CS3 / C++ http://www.arbuznikov.com Link to comment Share on other sites More sharing options...
Thareh Posted April 19, 2010 Author Share Posted April 19, 2010 Well, I can't create the buffers before since I don't know how many windows etc there's gonna be Does GetBufferColor save the buffers current state as a texture or does the texture change if I change the buffer afterward? If it saves the current state then perhaps I can just use 1 buffer and resize it, if that's possible. 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 April 19, 2010 Author Share Posted April 19, 2010 Local Buffer:TBuffer = CreateBuffer( W, H, BUFFER_COLOR ) SetBuffer( Buffer ) SetColor( Vec4( 1, 1, 1, 0 ) ) ClearBuffer() SetColor( Vec4( 1 ) ) 'DRAW STUFF HERE! Texture = GetColorBuffer( Buffer ) SetBuffer( BackBuffer() ) Buffer = Null Here's the 'Render to Texture' routine I'm using. 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 April 20, 2010 Author Share Posted April 20, 2010 There must be some way of speeding this up! >.< 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...
ArBuZ Posted April 20, 2010 Share Posted April 20, 2010 Do you really need buffer for each window. What are you doing with all this textures? Maybe create one buffer and draw there all windows? Quote Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64 3ds max / photoshop CS3 / C++ http://www.arbuznikov.com Link to comment Share on other sites More sharing options...
Thareh Posted April 20, 2010 Author Share Posted April 20, 2010 I free the buffer as soon as I've used GetColorBuffer to get the texture, well atleast I nullify it. I'm just using the buffer for the render to texture, and then I draw the Texture so I'm not using alot of buffers 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...
ArBuZ Posted April 20, 2010 Share Posted April 20, 2010 I mean you can use one buffer for all windows. And try not to create and free buffer for each window. Just create it once and draw windows there. And clear it between window drawing (not free). Quote Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64 3ds max / photoshop CS3 / C++ http://www.arbuznikov.com Link to comment Share on other sites More sharing options...
Thareh Posted April 20, 2010 Author Share Posted April 20, 2010 The problem is that the windows are of different sizes etc, if there's a way to resize a buffer it'd be possible! ^^ 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.