Jump to content

Help Here


Brad96

Recommended Posts

I want to explain this, each line please ... try to understand

texShader = dxCreateShader ( "shader/texreplace.fx" ) 
vehiclelights128 = dxCreateTexture("img/generic/vehiclelights128.png") 
vehiclelightson128 = dxCreateTexture("generic/vehiclelightson128.png") 
  
dxSetShaderValue(texShader,"gTexture",vehiclelights128) 
engineApplyShaderToWorldTexture(texShader,"vehiclelights128") 
  
dxSetShaderValue(texShader,"gTexture",vehiclelightson128) 
engineApplyShaderToWorldTexture(texShader,"vehiclelightson128") 
  
  

Link to comment

You want to know what each line does?

texShader = dxCreateShader ( "shader/texreplace.fx" ) -- Creates a shader element 
vehiclelights128 = dxCreateTexture("img/generic/vehiclelights128.png") -- Creates a texture element 
vehiclelightson128 = dxCreateTexture("generic/vehiclelightson128.png") -- Creates a texture element 
  
dxSetShaderValue(texShader,"gTexture",vehiclelights128) -- Sets the value of a shader element 
engineApplyShaderToWorldTexture(texShader,"vehiclelights128") -- Applies a shader to one or more world textures. 
  
dxSetShaderValue(texShader,"gTexture",vehiclelightson128) -- Sets the value of a shader element 
engineApplyShaderToWorldTexture(texShader,"vehiclelightson128") -- Applies a shader to one or more world textures. 

Link to comment

in the shader file (.fx) is a variable (like a "local value"). That variable is used in the shader to make it dynamic (like the color for the nitro).

So when you call "dxSetShaderValue" it will change the variable. (for the nitro you can pass the color, so when you set greend , the shander will be green, after that you set red =>> the shader will be red.)

In your case is "gTexture" witch in the shader is the .png file you wanna add for the shader (vehiclelights)

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