• ### What is your GameDev Story?

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

## Recommended Posts

I am VERY new att directx programming(and almost programming in general) and the book I am using(programming role-playing games with directx) uses dx8 but I want to write it in dx9 but unfortunatly I get some errors that I do not know how to fix¨ Code: #define VERTEXFVF (D3DFVF_XYZRHW | D3DFVF_TEX1) SetVertexShader(VERTEXFVF); I get the error: 'SetVertexShader' : cannot convert parameter 1 from 'const int' to 'struct IDirect3DVertexShader9 *' I have tried looking through the msdn library but I couldnt find anything that made sence to a n00b like me.

##### Share on other sites
You want SetFVF not SetVertexShader. Open up the DX SDK help file from your start menu and get used to typing in a function in the index to see what parameters it expects, I have to do it regularly.

##### Share on other sites
I am assuming that you have the latest DirectX 9 SDK or the DIrectX8 SDK that came with the book you are learning from.

If you do not then you can get the latest one from the Microsoft website.

#define VERTEXFVF (D3DFVF_XYZRHW | D3DFVF_TEX1)

What you are doing here is declaring a flexible vertex format which defines the layout of the struct you declare for the vertex.

This is NOT what you set as the vertex shader. In fact it is far from it. You have to first create a vertex shader. Once you have a shader you then tell it what FVF you want it to use.

I would suggest delving into the SDKs for the articles that explain how to get a blank window up and running onwards, up to rotating a mesh.

These are a very good introduction into the API. Don't let the book take you too far ahead of yourself otherwise you will only get confused. First start of with simple vertex buffers and the like and move on to shaders only when you have to.

Hope i have helped.

ace

##### Share on other sites
Quote:
 Original post by TodiloI am VERY new att directx programming(and almost programming in general) and the book I am using(programming role-playing games with directx) uses dx8 but I want to write it in dx9 but unfortunatly I get some errors that I do not know how to fix¨Code:#define VERTEXFVF (D3DFVF_XYZRHW | D3DFVF_TEX1)SetVertexShader(VERTEXFVF);I get the error: 'SetVertexShader' : cannot convert parameter 1 from 'const int' to 'struct IDirect3DVertexShader9 *'I have tried looking through the msdn library but I couldnt find anything that made sence to a n00b like me.

The problem is that SetFVF use to be SetVertexShader in Direct3D 8, but the 2 were separated in Direct3D 9. Most of the Direct3D8 code from the book would work, I assume, but you'll have to watch out for similar changes. When you encounter such a problem, try to check the documentation section "DirectX Graphics->Converting To DirectX 9.0" - it lists the changes between 8 and 9. For example, the problem you just encountered is listed under "Vertex Declaration changes" in the aforementioned documentation page.

##### Share on other sites
Coder knows all...

##### Share on other sites
I scratched my head so much that I almost became bald. First I would like to thank you all for your answers which unfortunatly did not help me solve the problem but get a better understanding. I looked through
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/convertingtodirectx9.asp

But frankly I did not understand it. I mean I see the problem but I can't come up with a solution.

http://pastebin.com/329257

Line 224 is where the problem is.

And again thank you for your support.

##### Share on other sites
Quote:
 Original post by TodiloI scratched my head so much that I almost became bald. First I would like to thank you all for your answers which unfortunatly did not help me solve the problem but get a better understanding. I looked throughhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/convertingtodirectx9.aspBut frankly I did not understand it. I mean I see the problem but I can't come up with a solution.http://pastebin.com/329257Line 224 is where the problem is.And again thank you for your support.

It's ok, no need for panic! You're still at the beginning, so take it easy [smile]

As for your problem, replace this line:
g_pD3DDevice->SetVertexShader(VERTEXFVF);

With this line:
g_pD3DDevice->SetFVF(VERTEXFVF);

##### Share on other sites

Regards,
Andre

This was not meant to be rude, though! Have fun :)[/edit]

##### Share on other sites
ohh now I remember :D. I did as christ told me even though I didnt really think it would work, and well it didnt because I just got a flashing window. Forgot to include the texture though. But I put the texture.bmp in the same folder but still only a a empty screen that exists as soon as it launches.

Edit: I changed it to windowed mode and now it works :D.

Thank you VERY much (especially "Coder" for giving me my hopes back).

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 12
• 13
• 10
• 11
• 13
• ### Forum Statistics

• Total Topics
634096
• Total Posts
3015482
×