#### Archived

This topic is now archived and is closed to further replies.

# Verts in a class -- why isn't this working?

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

## Recommended Posts

Ok, just trying to do some really simple things to get a feel for DirectX. I''m going through the NeXe examples. Maybe I''m just doing something stupid, but why does this work:
CVertex vtxTriangle[3];
...
g_pDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, vtxTriangle, sizeof(CVertex)); 
And this not?
class CTriangle
{
public:
CVertex verts[3];
};
CTriangle triangle;
...
g_pDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, triangle.verts, sizeof(CVertex)); 
Everything is initialized the same way, and I put a breakpoint and checked the data with the VS debugger and it''s the same for both, yet with one I Get a triangle, and the other I get nil.

##### Share on other sites
Have you checked the return value of the DrawPrimitive call? Are you running the debug runtime? What does the debug spew say?

neneboricua

##### Share on other sites
I just checked -- it returns S_OK.

Are you referring to the ... gyah, nevermind. I was doing something stupid. lol. A 0.0 should have been a 1.0. I swear I looked over that several times, and I had a feeling it was something like that. Guess that''s what I get for coding at like 4am.

• 11
• 20
• 12
• 10
• 38
• ### Forum Statistics

• Total Topics
631400
• Total Posts
2999862
×