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

Everything related to 3D programming
CodeCave
User
User
Posts: 16
Joined: Wed Jun 19, 2013 10:50 pm

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

Post 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 ?
CodeCave
User
User
Posts: 16
Joined: Wed Jun 19, 2013 10:50 pm

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

Post by CodeCave »

I tryed around a bit...
and now i use this *device\SetPixelShaderConstantF() as a workaround for now :/
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

Why stick with DX9 ? You should use DX11 now, it's shader model based and it's widely supported now.
CodeCave
User
User
Posts: 16
Joined: Wed Jun 19, 2013 10:50 pm

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

Post 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)
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

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

Post 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 :)
Image
CodeCave
User
User
Posts: 16
Joined: Wed Jun 19, 2013 10:50 pm

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

Post 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... :/
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

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

Post by Bananenfreak »

Thank you, I´m browsing through it whether i can use it or not :)
Image
Post Reply