yasin0 Posted June 5, 2017 Share Posted June 5, 2017 (edited) hello i don't know why don't work but don't debugscript error my code addEventHandler("onClientResourceStart", resourceRoot, function() myShader = dxCreateShader( "shader/shader.fx" ) aT = dxCreateTexture ("img/1.png") dxSetShaderValue(myShader,"gTexture",aT) engineApplyShaderToWorldTexture(myShader,"alleydoor9b") end ) shader texture gTexture; technique TexReplace { pass P0 { Texture[0] = gTexture; } } Edited June 5, 2017 by yasin0 Link to comment
3aGl3 Posted June 5, 2017 Share Posted June 5, 2017 (edited) So I can't see anything wrong with it on the first look, however if you use myShader somewhere else in your resource it could conflict. To solve that you will have to make the variables local, like this: addEventHandler("onClientResourceStart", resourceRoot, function() local myShader = dxCreateShader( "shader/shader.fx" ) local myTexture = dxCreateTexture( "img/1.png" ) dxSetShaderValue( myShader, "gTexture", myTexture ) engineApplyShaderToWorldTexture( myShader, "alleydoor9b" ) end ) Do note that I changed the textures variable name, it's always helpful to stick with speaking variable names Another thing that I could imagine to go wrong would be the texture name, did you use shader_tex_names to find it? Edit: It's also worth mentioning that you should include some error handling, as the creation of the shader is not guaranteed. Edited June 5, 2017 by 3aGl3 Link to comment
yasin0 Posted June 5, 2017 Author Share Posted June 5, 2017 (edited) yeah i used but don't worked @3aGl3 Edited June 5, 2017 by yasin0 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