Overkillz Posted April 8, 2019 Share Posted April 8, 2019 Hello dear community. Some weeks ago Im started to work with renderTarget more than the usual I used to do it and I've got 2 questions about it. Well, the first question is that. If I created a renderTarget with x/y size.While the size is bigger, is the Performance will be affected or it is going to be the same everytime ? And the second one, whats the goal to not to use a created renderTarget with the maximum size of the screen and later use dxDrawImageSection ?¿ It is even easier to work with dxButtons or things like that instead recode your typical "cursor hover button code" Here I post 2 examples that practically do the same thing In the case I wanted to work on the 20% of the screen. local sX,sY = guiGetScreenSize() -- ##OPTION 1 local sizeX,sizeY = sX*0.2,sY*0.2 local sizedRenderTarget = dxCreateRenderTarget(sizeX,sizeY,true) function drawSizedRenderTarget() dxSetRenderTarget( sizedRenderTarget ) --DRAW STUFFs dxSetRenderTarget() dxDrawImage.. -- Draw the renderTarget end addEventHandler("onClientRender",root,drawSizedRenderTarget) --##OPTION 2 local fullScreenRenderTarget = dxCreateRenderTarget(sX,sY,true) function drawFullScreenRenderTarget() dxSetRenderTarget( fullScreenRenderTarget ) --DRAW STUFFs dxSetRenderTarget() dxDrawImage.. -- Draw the renderTarget end addEventHandler("onClientRender",root,drawFullScreenRenderTarget) Thanks for reading. Regards. Link to comment
Moderators IIYAMA Posted April 9, 2019 Moderators Share Posted April 9, 2019 (edited) @Overkillz 1. Yes the performance will be affected depending on the hardware. The bigger the render target the more V-RAM it will be using. And ofcourse more pixels will be drawn. 2. If you want to focus on performance, then try to draw as less as possible times on the render target. Repeating operation is not necessary, unless the content is changing. Your 2 methods will work just fine. Just the method[1]: reducing the render target size might have better performance. Edited April 9, 2019 by IIYAMA 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now