Jump to content

dxSetRenderTarget doesn't work like it should


eSPeZet

Recommended Posts

Hello, can anyone explain why the following code doesn't run?

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        myRenderTarget = dxCreateRenderTarget( 80, 100 )    
        dxSetRenderTarget( myRenderTarget )                 
        dxDrawRectangle ( 2, 2, 60, 60, tocolor(255,255,0) ) 
        dxDrawText ( "Hello", 10, 20 )
        dxDrawText ( "Yoo", 10, 40 )
        dxDrawText ( "Ffs", 10, 60 )
        dxSetRenderTarget()                            
    end
)

addEventHandler( "onClientRender", root,
    function()
        if myRenderTarget then
            dxDrawImage ( 100, 200, 80, 100, myRenderTarget )       
        end
    end
)

 

This should definitely work, but somehow it ONLY works when the whole code is in 'onClientRender'.

And if i am wrong with that, then also all the documentations of MTA-wiki would be wrong

 

Yes I got enough free RAM..

 

My fk*** god...tried to solve it for hours before I created the post..RESTARTING the resource ingame HELPED! I did it from the console all the time -.- 

Edited by eSPeZet
solved
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...