Jump to content
  • Advertisement
Sign in to follow this  
rocklobster

OpenGL Opengl failing to draw in debug mode

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

I've got a problem with my debug mode in Visual Studio 2010. It seems that my models only draw when i'm in release mode, everytime i'm in debug mode the drawing is either really weird, or i can't see anything on screen.

This is my drawing code. Because each game object belongs to a node in a scene graph (i know its just a temporary solution) we have to traverse back through to its base node saving the matrices at each state, then we multiply down to get the child node's correct orientation. This works fine in release mode and the model is all oriented correctly, however in debug mode, I can't even see the model. If i remove all the matrix multiplications i can see the model, but everything isn't oriented correctly.

for (int i = 0; i < (signed)m_drawBuffer.size(); i++)
{
GameObject* go = m_drawBuffer;
//m_sortedDrawables.pop();
if (go->getComponent("ComponentRender") != NULL)
{
ComponentRender* render = (ComponentRender*)go->getComponent("ComponentRender");

for (int i = 0; i < render->modelResourceSize(); i++)
{
Matrix4<float> temp;
SceneNode* pos2 = go->getNode()->getRoot();
stack<Matrix4<float> > s;
s.push(go->getNode()->getOrientation());
while(pos2 != NULL)
{
s.push(pos2->getOrientation());
pos2=pos2->getRoot();
}
while(s.size()>0)
{
Matrix4<float> temp2= s.top();
s.pop();
temp = temp2 * temp;
}
matrixStackPush(); // gl push matrix
glMultMatrixf(temp.getMatrix());
int delta = render->getModel(i)->getVBOID();
if (render->getModel(i)->getVBOID() != -1)
drawVBO(render->getModel(i)->getVBOID(), GL_TRIANGLES);
matrixStackPop(); // gl pop matrix
}
}
}


Help would be greatly appreciated i'm dying trying to work this one out!

- Cheers

Share this post


Link to post
Share on other sites
Advertisement
Mostly this is the other way around that in debug stuff works, but release mode makes things go nuts.. Have you initialized everything properly?

Share this post


Link to post
Share on other sites
I'm using SDL for the window so i thought that was causing problems. So i setup my window in main and the put the opengl init code right after and i'm still getting the same problem. I've removed the mult matrix calls and i can see the object fine in both release/debug, but as soon as i try and change the model view matrix i cant see the object in debug, or by tweaking the camera, i see a gigantic grey square on my screen that is always in the same position (happens on both of my computers).

Share this post


Link to post
Share on other sites
I fixed it! It was a problem with double being treated like a float, apparently it will work in release but in debug mode it needed a proper type cast.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!