Page 1 of 1

How to use *device\CreatePixelShader(a,b) ?

Posted: Sat Jun 22, 2013 10:47 pm
by CodeCave
How can i create a colored PixelShader in PB (4.51) ?

I need to use the D3D9 device -> *device\CreatePixelShader(a,b)

I only found this c/c++ code: :shock:

Code: Select all

-> LPDIRECT3DPIXELSHADER9 Blue;

HRESULT GenerateShader(IDirect3DDevice9 *pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b )
{
    char szShader[ 256 ];
    ID3DXBuffer *pShaderBuf = NULL;
    sprintf( szShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", r, g, b, 1.0f );
    D3DXAssembleShader( szShader, sizeof( szShader ), NULL, NULL, 0, &pShaderBuf, NULL );
    if( FAILED( pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL;
    return S_OK;
}

-> GenerateShader( pDevice, &Blue, 0.0f, 0.0f, 1.0f );
How can i do that in PB ?

Re: How to use *device\CreatePixelShader(a,b) ?

Posted: Sun Jun 23, 2013 12:17 pm
by CodeCave
I tryed around a bit...
and now i use this *device\SetPixelShaderConstantF() as a workaround for now :/

Re: How to use *device\CreatePixelShader(a,b) ?

Posted: Sun Jun 23, 2013 1:09 pm
by Fred
Why stick with DX9 ? You should use DX11 now, it's shader model based and it's widely supported now.

Re: How to use *device\CreatePixelShader(a,b) ?

Posted: Sun Jun 23, 2013 1:48 pm
by CodeCave
Are there any samples out there on how to use the D3D11 *device\ in PB ?
(I use D3D9 cause im currently creating an overlay for another program)

Re: How to use *device\CreatePixelShader(a,b) ?

Posted: Mon Jun 24, 2013 7:56 am
by Bananenfreak
Where do you got these informations from?

Code: Select all

*device\SetPixelShaderConstantF()
I´m interested in shaders and it would be nice if you have sites for it and share them :)

Re: How to use *device\CreatePixelShader(a,b) ?

Posted: Mon Jun 24, 2013 8:47 pm
by CodeCave
got that info from msdn and translated it to PB as so often...
http://msdn.microsoft.com/en-us/library ... s.85).aspx

theres no documentation for PB about the d3d9/11 device\ stuff as far as i know... :/

Re: How to use *device\CreatePixelShader(a,b) ?

Posted: Tue Jun 25, 2013 8:20 am
by Bananenfreak
Thank you, I´m browsing through it whether i can use it or not :)