Jump to content

renderTarget issue while drawing more than X items


Overkillz

Recommended Posts

Hello dear community, Im working with renderTargets since is a way that losing a bit of quality you can get an incredible performance.

However, today I have faced an issue while drawing some text.

Well, I have like 4k maps and obyously, each one has his own name.

Well, while using renderTargets, I can't draw more than 1000 text

I tried it while using a custom font and few stuffs more.

If you think that my code is wrowng, here I left you the way Im working

local sX,sY = guiGetScreenSize()
local sizeX,sizeY = sX/2,sY/2
local fontHeight = dxGetFontHeight(1,"default-bold")

local items = {}

for n=1,4000 do
	table.insert(items,{text = "test"..n, path = "whatever", anim = 0, active = false})
end

local rt = dxCreateRenderTarget(sizeX,fontHeight*#items,true)

function drawContent()
	dxSetRenderTarget(rt, true)
	dxSetBlendMode("modulate_add")
		dxDrawRectangle(0,0,sizeX,fontHeight*#items,tocolor(255,0,0,100))
		for i,k in ipairs(items)  do
			dxDrawText(k.text,0,fontHeight*(i-1),sizeX,fontHeight*(i-1)+fontHeight,tocolor(255,255,255,255),1,"default-bold")
		end
	dxSetBlendMode("blend")
	dxSetRenderTarget()
end

function renderContent()
	if rt then
		dxDrawImage(0,0,sizeX,sizeY,rt,0,0,0,tocolor(255,255,255,255))
	end
end

drawContent()
addEventHandler("onClientRender",root,renderContent)

I hope you can bring me a hand with this issue.

Or a way to draw like 4k map names without affecting the performance.

Best regards.

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...