Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem With Vertex Buffer??

Started by m_a_s_gp Oct 5, 2010 at 1:58 PM 1 replies 550+ views
Original Post
m_a_s_gp
m_a_s_gp
hi,

I am trying to draw a simple quad on the screen using direct3d.
To do this, I fill a vertex buffer and an index buffer with
the requaired vertex and index arrays, and use the
DrawIndexedPrimitive function.

The quad is drawn only if I declare my vertex array as a fixed array:

VERTEX vArray[4];

and pass it directly to the (memcpy) function, which I use to fill
the vertex buffer.

but when I try to use a dynamic array:

VERTEX *vArray = new VERTEX[4];

or when I try to pass a fixed array as an argument to a function
that use it to fill the buffer by passing it again to the (memcpy),
nothing is shown on the screen..

Do anybody know why does this happen?

thanks in advanced and sorry for my poor english..
Buckeye
Buckeye
Sounds like a problem with your sizeof() argument.
VERTEX vArray[4];sizeof(vArray) = 4*sizeof(VERTEX)VERTEX* vArray;sizeof(vArray) = 4 // size of a pointer
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly. You don't forget how to play when you grow old; you grow old when you forget how to play.
m_a_s_gp
m_a_s_gp
solved..
it's as you said, I am using sizof(vArray).

thanks a lot..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.