Hi,
I have over 300 points of vertex array. I can use the first four points to draw a quad on the screen. Can anyone show me how to use the rest of points to draw more quads?
Thank you for help
My code is
void COGLView: rawScene()
{
//Commented the following code ...
//====== Create the new list of OpenGL commands
glNewList(1, GL_COMPILE);
//====== Set the polygon filling mode
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//Connecting to Shared Memory to create Mesh
m_general_Mesh = new CMesh();
m_general_Mesh->InitializeMeshConnection();
m_TotalPointsArray = new Vertex_Data[m_general_Mesh->m_iTotalPoints];
for (int a = 0; a < m_general_Mesh->m_iTotalPoints ; a++)
{
m_TotalPointsArray[a].x = m_general_Mesh->MeshVertexArray[a].x;
m_TotalPointsArray[a].y = m_general_Mesh->MeshVertexArray[a].y;
m_TotalPointsArray[a].z = m_general_Mesh->MeshVertexArray[a].z;
}
//====== Turn on the primitive connection mode (not connected)
if (m_bQuad)
glBegin (GL_QUADS);
float xi = m_TotalPointsArray[0].x/10;
float yi = m_TotalPointsArray[0].y/10;
float zi = m_TotalPointsArray[0].z = 0.0f;
float xj = m_TotalPointsArray[1].x/10;
float yj = m_TotalPointsArray[1].y/10;
float zj = m_TotalPointsArray[1].z = 0.0f;
float xk = m_TotalPointsArray[2].x/10;
float yk = m_TotalPointsArray[2].y/10;
float zk = m_TotalPointsArray[2].z = 0.0f;
float xn = m_TotalPointsArray[3].x/10;
float yn = m_TotalPointsArray[3].y/10;
float zn = m_TotalPointsArray[3].z = 0.0f;
//===== Not connected quads branch
if (m_bQuad)
{
//====== Vertices are given in counter clockwise direction order
if (zi < -10.0000)
glColor3f (0.0f, 1.0f, 0.f);
else
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(xi, yi, zi);
glVertex3f(xj, -yj, zj);
glVertex3f(-xk, -yk, zk);
glVertex3f(-xn, yn, zn);
}
// }
//====== Close block of GL_QUADS commands
if (m_bQuad)
glEnd();
//====== Close the list of OpenGL commands
glEndList();