Gallardo9944 Posted October 24, 2013 Posted October 24, 2013 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. Code Debugger - Minimalistic MTA debug line replacement
csiguusz Posted October 24, 2013 Posted October 24, 2013 You can't apply shaders to gui elements. Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003
Gallardo9944 Posted October 24, 2013 Author Posted October 24, 2013 You can't apply shaders to gui elements. Just like I thought. Thanks anyway, gonna replace all the GUI stuff with dx-drawn thingies. Code Debugger - Minimalistic MTA debug line replacement
Ren_712 Posted October 29, 2013 Posted October 29, 2013 well you can draw dxDrawImage behind the window and update it's shape and position onClientRender, stretch the screenSource image in the pixel shader to make it more convenient. http://imageshack.us/a/img43/7273/64a5.jpg I make shaders .. mainly. My community resources I'll do some custom stuff, I'm open for cooperation.
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