🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published August 24, 2006
Advertisement
OH JESUS CHRIST

Ok, spot what's wrong with this line:
memcpy(pVertex, &m_vFrames[0].vVertices[0], m_nTriangles*3);

pVertex is returned from locking a VB.

That bug has taken me the best part of 2 hours to track down. At least my MD2 loading code works now...



Ok, here's a screenie of the engine so far. I can load a MD2 model just fine now, and render it as an indexed triangle list. I had to muck about a bit though, since texture coordinates are specified per triangle, not per vertex. So I've duplicated a lot of vertices in order to get a 1:1 mapping of texture coordinates to vertices (I just created 3*num_triangles vertices).
I should optimize this by going through and removing duplicate vertices. This should be pretty straightforwards to do, I'll try to do it on the train on the way home.

Anyway, screenie:
Engine screenie
Click to Enlarge

Nothing special, just showing a rotating wireframe MD2 model with my GUI code functioning with it. Gets around 83FPS on my laptop, which is pretty beastly.
Previous Entry Untitled
Next Entry Untitled
0 likes 4 comments

Comments

BDePesa
Sexy.
August 24, 2006 08:15 AM
Programmer16
Awesomeness!
August 24, 2006 11:07 AM
Giallanon
I suppose your vertex is not one byte long so the memcpy should be something like this:

memcpy (pVertex,&m_vFrames[0].vVertices[0], m_nTriangles*3 * sizeof(m_vFrames[0].vVertices[0]));
August 24, 2006 01:36 PM
Evil Steve
Quote: Original post by Giallanon
I suppose your vertex is not one byte long so the memcpy should be something like this:

memcpy (pVertex,&m_vFrames[0].vVertices[0], m_nTriangles*3 * sizeof(m_vFrames[0].vVertices[0]));
Zing! You win the prize [smile]
August 24, 2006 01:51 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement