Jump to content

Problem with shaders


Piorun

Recommended Posts

Hi guys.

I have problem with my shader. It's fx file:

texture Tex0; 
  
technique simple 
{ 
    pass P0 
    { 
        //-- Set up texture stage 0 
        Texture[0] = Tex0; 
  
        //-- Leave the rest of the states to the default settings 
    } 
} 

and lua code:

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        myShader,tecName = dxCreateShader( "efect.fx" ) 
        myImage = dxCreateTexture( "info.png" ) 
        if myShader and myImage then 
            dxSetShaderValue( myShader, "Tex0", myImage ) 
            outputChatBox( "Shader using techinque " .. tecName ) 
        else 
            outputChatBox( "Problem - use: debugscript 3" ) 
        end 
    end 
) 
  
addEventHandler( "onClientRender", root, 
    function() 
        if myShader then 
             dxDrawImage( 200, 300, 400, 200, myShader, 0, 0, 0, tocolor(255,255,0) ) 
        end 
   end 
) 

And this is some warn:

There were no techniques, 
Compilation failed 

What's wrong?

Link to comment

the .fx file must be similar to this

  
float4 MyShader(.... ) ... 
{ 
................. 
} 
  
  
  
technique fog 
{ 
    pass p1 
    { 
        VertexShader = null; 
        PixelShader = compile ps_2_0 MyShader(); 
    } 
  
} 
  

Link to comment

Ok, but what im putting here?:

  
float4 MyShader(.... ) ... 
{ 
................. <-- here 
} 
  

EDIT

Anyway on wiki there is this example for fx file:

texture Tex0; 
texture Tex1; 
  
//-- Very simple technique 
technique simple 
{ 
    pass P0 
    { 
        //-- Set up texture stage 0 
        Texture[0] = Tex0; 
        ColorOp[0] = SelectArg1; 
        ColorArg1[0] = Texture; 
        AlphaOp[0] = SelectArg1; 
        AlphaArg1[0] = Texture; 
  
        //-- Disable texture stage 1 
        ColorOp[1] = Disable; 
        AlphaOp[1] = Disable; 
    } 
} 

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