Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

VanKurt

I can see everything except the vArray

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

I''ve got another strange problem: Everything I draw (like quads, triangles etc.) is visible EXCEPT my VertexArray. I turned off culling, blending and fog, but it reamained invisible. I know that my code is working because I took it from one of my other projects. I also checked the values inside my array: They''re OK. So why can this thing be invisible? PS: The array is drawn like this:
  
void CTerrain::DrawPatch( unsigned int index )
{

// DRAW A QUAD (IS VISIBLE)

			float x = terrain_vertices[patch[index].vertex_indices[0]].x;
			float z = terrain_vertices[patch[index].vertex_indices[0]].z;

			glBegin( GL_QUADS );
				glTexCoord2f( 1.0f, 0.0f);
				glVertex3f(	x, waterHeight, z );

				glTexCoord2f( 1.0f, 1.0f);
				glVertex3f(	x + (patchWidth-1) * GlobalSettings.terrain.stretch_x, waterHeight*5, z );

				glTexCoord2f( 0.0f, 1.0f);
				glVertex3f(	x + (patchWidth-1) * GlobalSettings.terrain.stretch_x, waterHeight*5, z + (patchWidth-1) * 

GlobalSettings.terrain.stretch_z );

				glTexCoord2f( 0.0f, 0.0f);
				glVertex3f(	x, waterHeight, z + (patchWidth-1) * GlobalSettings.terrain.stretch_z );
			glEnd();


// DRAW THE ARRAY (INVISIBLE)


	patchDrawn[index] = true;

	unsigned int	a =0;
	unsigned int	b =0;
	int				counter =0;
	unsigned int cur_indices[18];

	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

	for( a=0; a<patchWidth-1; a++ )
	{
		counter = a;
		for( b=0; b<patchWidth*2-1; b+=2 )
		{
			cur_indices[b] = patch[index].vertex_indices[counter];
			cur_indices[b+1] = patch[index].vertex_indices[counter+1];
			counter += patchWidth;
		}// end for


		glDrawElements(GL_TRIANGLE_STRIP,patchWidth*2,GL_UNSIGNED_INT, &cur_indices);
	}// end for


} // end DrawPatch

  
Thanks a lot, bobo

Share this post


Link to post
Share on other sites
Advertisement

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