Sign in to follow this  

CreatePixelShader help

This topic is 2667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

basically i am trying to learn pixel shaders the asm way , so here is my code


LPDIRECT3DPIXELSHADER9 Blue;

HRESULT CreateMyShader(IDirect3DDevice9 *Device,IDirect3DPixelShader9 **pShader, float red, float green, float blue, float alpha )
{
ID3DXBuffer *MyBuffer = NULL;
char MyShader[ 256 ];
sprintf( MyShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", red/255, green/255, blue/255, alpha/255 );
D3DXAssembleShader( MyShader, sizeof( MyShader ), NULL, NULL, 0, &MyBuffer , NULL );
if( FAILED( Device->CreatePixelShader((const DWORD*)MyBuffer ->GetBufferPointer(), pShader)) )return E_FAIL;
return S_OK;
}

//to create the pixelshader i do
CreateMyShader( pd3dDevice, &Blue, 0, 0, 255 , 255 );//blue

//and in renderscene before drawsubset i have

npDevice->SetPixelShader(Blue);

[/source

but the object is not being colored blue, does anyone know why?


Share this post


Link to post
Share on other sites

This topic is 2667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this