[Solved] Drawing problem dx11
Posted: Wed May 23, 2012 6:20 pm
Hey guys n gals (dandy), I have a problem with drawing in direct x 11. I am pretty familiar with how everything works, but this has thrown a curveball at me. Heres whats going on:
I have a struct that holds position data for vertices, and texture coords. Simple and easy. I can create an array of 3 of these using SimpleVertex sv[3] = {shit goes here}, upload to vertex buffer, draw, no problemo. Heres where i'm having trouble though, I can create an array like this SimpleVertex * sv = new SimpleVertex[3], fill out the info dynamically like sv[0].Pos = {shit goes here}. Okay. I fill all the info in, upload to vertex buffer, draw, nothing gets drawn.
So testing to see whats going on, I create a SimpleVertex *, and a SimpleVertex[], set the * to = [], so they should technically be the exact same, upload the * to vertex buffer, draw, nothing. Upload the [], draw, it shows. What am I missing here? I thought * and [] were practically the same?
In every draw, everything is filled out right, the difference is whether i'm using static or dynamic arrays. I am using drawinstance() call. Anyone know what might be the cause?
Oh just figured it out!!!! When updating the vertex buffer, when using STATIC arrays the array needs a & in front, and dynamic arrays DON'T!
I have a struct that holds position data for vertices, and texture coords. Simple and easy. I can create an array of 3 of these using SimpleVertex sv[3] = {shit goes here}, upload to vertex buffer, draw, no problemo. Heres where i'm having trouble though, I can create an array like this SimpleVertex * sv = new SimpleVertex[3], fill out the info dynamically like sv[0].Pos = {shit goes here}. Okay. I fill all the info in, upload to vertex buffer, draw, nothing gets drawn.
So testing to see whats going on, I create a SimpleVertex *, and a SimpleVertex[], set the * to = [], so they should technically be the exact same, upload the * to vertex buffer, draw, nothing. Upload the [], draw, it shows. What am I missing here? I thought * and [] were practically the same?
In every draw, everything is filled out right, the difference is whether i'm using static or dynamic arrays. I am using drawinstance() call. Anyone know what might be the cause?
Oh just figured it out!!!! When updating the vertex buffer, when using STATIC arrays the array needs a & in front, and dynamic arrays DON'T!