Jump to content

A gui element attached to the shader made with render target


Gallardo9944

Recommended Posts

Hello.

I've got a shader made with a render target and I want to attach a GUI element to that shader. Is there any ability to do that?

Here goes my code:

  
local mainTarget = dxCreateRenderTarget(sx,sy,true) 
local mainShader = dxCreateShader("textureReplace.fx") 
  
function updateRTarget() 
    dxSetRenderTarget(mainTarget,true) 
    dxDrawRectangle(0,0,sx,sy,tocolor(0,0,0,150)) -- sx and sy are the target sizes. 
    dxSetRenderTarget() 
    dxSetShaderValue(mainShader, "tex", mainTarget) -- Setting a shader "tex" value to the target we have 
end 
  
  
function drawInterface() 
  updateRTarget() 
  -- Rotating the shader to a particular angle. 
  dxSetShaderTransform(mainShader,rot,0,0) -- I want a GUI element to rotate and move together with the shader without a need to calculate a position of the element. 
  dxDrawImage(posX,posY,sx,sy,mainShader) 
end 
addEventHandler("onClientRender",getRootElement(),drawInterface) 
  

Thanks in advance.

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