leozin99 Posted August 26, 2012 Share Posted August 26, 2012 I want load a texture of clothing using shader, I saw this on a other topic. someone could help me with code? Link to comment
Anderl Posted August 26, 2012 Share Posted August 26, 2012 This is my first shader code so sorry if it does not work: Client-side: local pShader = dxCreateShader( 'clothe.rep.fx' ); -- change this to the shader file name if( pShader ) then -- check if shader was created successfully local pTexture = dxCreateTexture( 'clothtexture.png' ); -- create texture || change here to the texture file name if( pTexture ) then -- check if texture was created successfully dxSetShaderValue( pShader, 'clotheTexture', pTexture ); -- set shader texture to the texture we created -- engineApplyShaderToWorldTexture( pShader, 'clothe_text_name'--[[, TARGET [ not needed ] ]] ); -- apply texture to the world || change here to the clothe texture name you want to replace and maybe fill target with an element if you don't want it to be applied to all world textures with this name end end Shader file: texture clotheTexture; technique clotheTexRep { pass P0 { Texture[0] = clotheTexture; } } Link to comment
leozin99 Posted August 27, 2012 Author Share Posted August 27, 2012 Next is giving the error: ERROR: shader \ client.lua: 1: attempt to call global 'dxCreateShader' (a nil value) Link to comment
Castillo Posted August 27, 2012 Share Posted August 27, 2012 Your script must be set as server side ( type="server" ) at the meta.xml, but it should be client side ( type="client" ). 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