Overkillz Posted January 10, 2018 Share Posted January 10, 2018 Hello dear community, well, today I started to working with shaders and I have 2 questions about them. The first one is how can I modify the following variable float3 colorrgb = float3(255,255,255); with dxSetShaderValue. I tried to use: dxSetShaderValue(myShader, "colorrgb", 255,0,0) but it didn't work. Will give I get problem while using dxSetShaderValue on a render ? Thats all for now. I hope u can bring me a hand. Thanks for reading. Best regards. Link to comment
3aGl3 Posted January 10, 2018 Share Posted January 10, 2018 1) Just use float3 colorrgb; in your shader, that should allow you to use dxSetShaderValue, you could also see the examples on the wiki for more details. 2) I suppose you are asking if you get problems when you call dxSetShaderValue in onClientRender events. Actually I'm not sure but I wouldn't call it more than really necessary. 1 Link to comment
Slim Posted January 10, 2018 Share Posted January 10, 2018 13 hours ago, Overkillz said: The first one is how can I modify the following variable float3 colorrgb = float3(255,255,255); with dxSetShaderValue. I tried to use: dxSetShaderValue(myShader, "colorrgb", 255,0,0) but it didn't work. .FX Something like this: float3 color; Should be in your .FX file, find the tag, for example this one is "color"..LUA function resource_starts() dxSetShaderValue(shader, "color", 255, 0, 0) end addEventHandler("onClientResourceStart", getRootElement(), resource_starts) 13 hours ago, Overkillz said: Will I get a problem while using dxSetShaderValue with onClientRender ? onClientRender constantly is called EVERY TIME the clients screen renders a frame, it's not efficient for something like what you need. You're gonna have to find a new event to replace it.https://wiki.multitheftauto.com/wiki/Client_Scripting_Events I recommend onClientResourceStart Quote onClientRender Clientside event This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them. Source: MTA SA Wiki 1 Link to comment
Scripting Moderators thisdp Posted January 11, 2018 Scripting Moderators Share Posted January 11, 2018 dxSetShaderValue(shader, "color", {255, 0, 0}) 1 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