Jump to content

Questions abouts renderTargets


Recommended Posts

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

@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 by IIYAMA
  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...