Jump to content

[Help] Failed to load texture


TheBull

Recommended Posts

Posted

Helloo,I made a texture load script by looking to (engineApplyShaderToWorldTexture) in the wiki,but somehow it doesn't load the texture i want to load,it just becomes a clean white hydra,not customized or not even the original one,could you guys help me?

Here is the client.lua :

myShader = dxCreateShader( "replace.fx" ) 
engineApplyShaderToWorldTexture( myShader, "hydrabody256" ) 
----------------------------------------------------------------- 
myShader = dxCreateShader( "replace.fx" ) 
engineApplyShaderToWorldTexture( myShader, "hydradecal" ) 

Posted

engineApplyShaderToWorldTexture ( element shader, string textureName [, element targetElement = nil, bool appendLayers = true ] )

You forgot about the texture file.

Posted
do you mean this?
texture gTexture; 
  
technique hello 
{ 
    pass P0 
    { 
        Texture[0] = gTexture; 
    } 
} 
  

This is the shader, where's the texture you are providing to the shader to use?

Posted

i made it like this :

dxSetShaderValue(replace.fx, 'texture0', hydrabody256.png) 

and got this error : attempt to index global 'replace' (a nil value)

Posted

I suggest you start reading more Lua tutorials.

The first argument is the shader you created, in this case it's 'myShader'. The third one is a texture, can be an image or a texture element created with dxCreateTexture. You need to specify a texture to replace the existing (GTA's default) one.

dxSetShaderValue(myShader, 'gTexture', TEXTURE 

If you didn't understand that then we probably can't help you.

Posted

I know what do you mean,but i dont even get any errors

addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        local texture = dxCreateTexture ( "images/hydrabody256.jpg", "dxt5" ) 
        local shader = dxCreateShader ( "texture.fx" ) 
        dxSetShaderValue ( shader, "gTexture", texture ) 
        engineApplyShaderToWorldTexture ( shader, "hydrabody256" ) 
    end 
) 

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