textures dissapear as a result of using D3DVECTOR?

Started by
1 comment, last by Skykid 18 years, 10 months ago
OK, So I am switching over to using vectors in my application #define CUSTOM_VERTEX_FVF D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX2 struct Vertex { //float x,y,z,rhw; previously I used D3DFVF_XYZRHW in the define D3DVECTOR position; D3DCOLOR diffuse; float u,v; float u2,v2; }; ...but as a result, the textured images in my program all dissapear. I really dont have clue how that happened, but I found that replacing D3DFVF_XYZ with D3DFVF_XYZRHW makes the textured images appear but very dark in color, redish actually. I am also using the following SetTextureStateState functions and thought that maybe they had something to do with this. pD3Ddevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE); pD3Ddevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); pD3Ddevice->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE); ...anybody ever experience this wierdness? any help would be greatly appreciated!
Advertisement
Sounds like you missed something in your convertion. Is the only change you made from
struct{ float x, y, z, rhw; .... } to struct { D3DVECTOR; ... }
and the change with your fvf?
If so, you might try tossing your original struct back together and eliminate the rhw component. See if the results are the same as you described above with the change.
It sounds like your software is not sharing the same idea about how to use that structure. Dark red could mean that a piece of code is still using rhw loc which now translates down into the red component your diffuse.
Kick it around. =)
Awesome.... I found the solution..

That thing you said about "rhw loc which now translates down into the red component your diffuse." made me realize that I still needed that rhw value. I changed my custom vertex to the following


#define CUSTOM_VERTEX_FVF D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX2

struct Vertex
{

D3DVECTOR position;
float rhw;
D3DCOLOR diffuse;
float u,v;
float u2,v2;
};

...and now it works , Thanks!!!

This topic is closed to new replies.

Advertisement