Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423606

Untitled

Sign in to follow this  
Evil Steve

114 views

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.
Sign in to follow this  


4 Comments


Recommended Comments

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]));

Share this comment


Link to comment
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]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!