Faulty shader system

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Guest

Post by Guest »

everything is the same as the shader example ecept the shader(pixel)
mandrav
Posts: 117
Joined: Sat Aug 27, 2005 8:29 pm
Contact:

Post by mandrav »

Here's my shader's callback:

Code: Select all

class TerrainShader : public video::IShaderConstantSetCallBack
{
public:

    virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 user)
    {
        // set 4 texture units for splatting terrain
        int c[] = { 0, 1, 2, 3 }; // sampler2d IDs
        services->setPixelShaderConstant("dirt", (float*)&c[0], 1);
        services->setPixelShaderConstant("grass", (float*)&c[1], 1);
        services->setPixelShaderConstant("pebbles", (float*)&c[2], 1);
        services->setPixelShaderConstant("alphamap", (float*)&c[3], 1);
    }
};
This is why I said it's a hack and could be done better. Ideally, niko should add a setPixelShaderConstant() overload taking ints. I just hacked it together to make sure it works.
Guest

Post by Guest »

thanks but it still doesnt work

can you just please give us a sample project with complete code like every one does when they fix bugs it will stop us from annoying you :wink:
Guest

Post by Guest »

no need for that i got it working

a big thank you

and sorry for being annoying
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Patch included in the recent SVN revision (101).
Post Reply