Karuzo Posted February 21, 2014 Share Posted February 21, 2014 Sup Community, i have a question 'bout dxCreate/dxSet - RenderTarget , i don't understand how this actually works. A friend of mine explained it to me, but i just don't get it. I think it's like a box or smth like that, so the dx Creations won't go outside of it. Or is it like a parent but just for the DirectX Creations ? But i don't really know if that's true, and i would be so happy if someone could explain that to me. Regards, KRZO. Link to comment
Bonsai Posted February 21, 2014 Share Posted February 21, 2014 The Wiki and maybe a bit testing by yourself provides anything you need to know. Link to comment
Moderators Citizen Posted February 21, 2014 Moderators Share Posted February 21, 2014 i have a question 'bout dxCreate/dxSet - RenderTarget ,i don't understand how this actually works. Maybe 'cuz those functions doesn't even exist ? Please explain better or use the correct words / function names Link to comment
arezu Posted February 22, 2014 Share Posted February 22, 2014 Render targets are like textures (images) that you can draw on, think of it like layers in photoshop. You can draw on it using dx functions like dxDrawText/dxDrawImage, and anything that is draw outside the area of the render target will get "cut off". Simple example: -- true as third argument creates the render target with transparent background local renderTarget = dxCreateRenderTarget(640, 480, true) -- Using true as second argument will clear/erase the content of the render target, making it fully transparent dxSetRenderTarget(renderTarget, true) -- Position starts from top left of the render target! dxDrawText("test", 0, 0) -- Calling dxSetRenderTarget with no arguments will set the render target on which dx content will be drawn on to the screen, so we can draw the render target on the screen now dxSetRenderTarget() addEventHandler("onClientRender", root, function() -- You can treat the render target like a texture dxDrawImage(300, 300, 640, 480, renderTarget) end) Render targets can be used if you want to increase performance by only a lot of drawing dx stuff once, and display it many times, or if you want to "draw" using lua to a texture, or if you want to rotate text in 3d together with shader. Render targets can also be used if you want to scale an image and still have good quality, as using render targets somehow scale better visually. Also you make sure to play with dxSetBlendMode to get best visual result, otherwise it can look weird. Link to comment
Karuzo Posted February 22, 2014 Author Share Posted February 22, 2014 Ah! Know i understand arezu, thank you for your help! @Citizen: I mean dxSetRenderTarget and dxCreateRenderTarget Link to comment
Moderators Citizen Posted February 22, 2014 Moderators Share Posted February 22, 2014 Ah!Know i understand arezu, thank you for your help! @Citizen: I mean dxSetRenderTarget and dxCreateRenderTarget Ah yeah sorry, I could guess if I knew that functions (Never used them so ^^) Link to comment
Bonsai Posted February 22, 2014 Share Posted February 22, 2014 I discovered using the postGUI argument when drawing to a render target will make it fail. Maybe you will need this. Link to comment
Karuzo Posted February 22, 2014 Author Share Posted February 22, 2014 Thank you , gonna watch out for it if i use postGUI 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