Jump to content
  • Advertisement
Sign in to follow this  
giugio

OpenGL polygon and draw

This topic is 3626 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

Hy . I have implemented a polygon class . All work fine with one poly, but with more polygon something don't work. this is the draw function , the vertex and the faces are ok , i have controlled 34234234234 times , but.. I ask you if the draw function(the opengl sintax)have somthing wrong void CPolygon::Draw() { FACE* ptrFace = m_PolyData->m_faces; INDEX* ptrIndex = NULL; int nIndexCount = 0 ; int ixface=1; glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); int nfacesCount = m_PolyData->m_nFacesCount; while(nfacesCount -- )//the number of face of the polygon { ptrIndex = m_PolyData->m_faces[nfacesCount].pIndex; nIndexCount = m_PolyData->m_faces[nfacesCount].nCount; glPushMatrix(); glBegin(GL_POLYGON); while(nIndexCount--)// number of vertex of the face { int pIdx =m_PolyData->m_faces[nfacesCount].pIndex[nIndexCount].nVertex;// index of the vertex GLfloat f1 = m_PolyData->m_vertexs[pIdx].val[0]; GLfloat f2 = m_PolyData->m_vertexs[pIdx].val[1]; GLfloat f3 = m_PolyData->m_vertexs[pIdx].val[2]; glVertex3f(f1,f2,f3);//vertexs coord at index } glEnd(); glPopMatrix(); } thanks

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!