Gordon_G Posted September 22, 2018 Share Posted September 22, 2018 Hi, I have a shader (here) that replace an object's texture and here is my code : (red.png ; blue.png) local o = createObject( 2121, 1418.1678466797,-1595.0837402344,13.366353988647 ) dxSetShaderValue( shaderForImageLoading, "gTexture", dxCreateTexture( "red.png" ) ) engineApplyShaderToWorldTexture( shaderForImageLoading, "cj_red_leather", o ) local o1 = createObject( 2121, 1411.8753662109,-1591.5054931641,13.360206604004 ) dxSetShaderValue( shaderForImageLoading, "gTexture", dxCreateTexture( "blue.png" ) ) engineApplyShaderToWorldTexture( shaderForImageLoading, "cj_red_leather", o1 ) So, the prob is that I'd like that the first object to have the texture red.png but it gets the blue.png one Is it possible to "freeze" the shader for a worldTexture ? Or... Am I supposed to create a shader for each object I want to replace the texture of ? It will take a lot of the client vram if I have a lot of objects isn't it ? Link to comment
Dimos7 Posted September 22, 2018 Share Posted September 22, 2018 (edited) local o = createObject( 2121, 1418.1678466797,-1595.0837402344,13.366353988647 ) shader1 = dxCreateShader("texReplace.fx", 0, 0 , false, "object") red = dxCreateTexture("red.png") dxSetShaderValue( shader1, "gTexture", red ) engineApplyShaderToWorldTexture( shader1, "gTexture", o ) local o1 = createObject( 2121, 1411.8753662109,-1591.5054931641,13.360206604004 ) shader2 = dxCreateShader("texReplace.fx", 0, ,0, false, "object") blue = dxCreateTexture("blue.png") dxSetShaderValue( shader2, "gTexture",blue) engineApplyShaderToWorldTexture( shader2, "gTexture", o1 ) Edited September 22, 2018 by Dimos7 1 Link to comment
Gordon_G Posted September 22, 2018 Author Share Posted September 22, 2018 (edited) Ok but.. Will it be* ok for low configs ? Edited September 22, 2018 by Gordon_G 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