Jump to content
  • Advertisement

Archived

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

Vlion

STL vector debugging.

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

Ok. I`m working on a routine to put all of my model into a text file so that I can look at all the coords. However... I`m getting an access violation
//drops all vertexes, local and transformed, along with local color and transformed color.
void c4Model::DropModel()
{
	fstream file;
	file.open("model.txt",ios::out);
	c3PointC pt3c;
	file << "List of triangles and vertexes in this c4Model./n";
	int temp = 0;
	while(temp < header.numtris)
	{
		file << "\nTriangle: " << temp;
		file << "\nVertex 1, local coord: " << vertexlist[trilist[temp].vert0].x << "," << vertexlist[trilist[temp].vert0].y <<"," << vertexlist[trilist[temp].vert0].z << "," << vertexlist[trilist[temp].vert0].q;
		file << "\nVertex 1, local color: " << vertexlist[trilist[temp].vert0].r << "," << vertexlist[trilist[temp].vert0].g << "," << vertexlist[trilist[temp].vert0].b << "," << vertexlist[trilist[temp].vert0].a;
		file << "\nVertex 1, transformed coord: " << pt3c.x << "," << pt3c.y << "," << pt3c.z;
		file << "\nVertex 1, transformed color: " << pt3c.r << "," << pt3c.g << "," << pt3c.b << "," << pt3c.a;
		pt3c = modelpipe.Pipe(vertexlist[trilist[temp].vert0]);//this generates a access violation
	
		file << "\nVertex 2, local coord: " << vertexlist[trilist[temp].vert1].x << "," << vertexlist[trilist[temp].vert1].y << "," << vertexlist[trilist[temp].vert1].z << "," << vertexlist[trilist[temp].vert1].q;
		file << "\nVertex 2, local color: " << vertexlist[trilist[temp].vert1].r << "," << vertexlist[trilist[temp].vert1].g << "," << vertexlist[trilist[temp].vert1].b << "," << vertexlist[trilist[temp].vert1].a;
		pt3c = modelpipe.Pipe(vertexlist[trilist[temp].vert1]);//and here
		file << "\nVertex 2, transformed coord: " << pt3c.x << "," << pt3c.y << "," << pt3c.z;
		file << "\nVertex 2, transformed color: " << pt3c.r << "," << pt3c.g << "," << pt3c.b << "," << pt3c.a;

		file << "\nVertex 3, local coord: " << vertexlist[trilist[temp].vert2].x << "," << vertexlist[trilist[temp].vert2].y << "," << vertexlist[trilist[temp].vert2].z << "," << vertexlist[trilist[temp].vert2].q;
		file << "\nVertex 3, local color: " << vertexlist[trilist[temp].vert2].r << "," << vertexlist[trilist[temp].vert2].g << "," << vertexlist[trilist[temp].vert2].b << "," << vertexlist[trilist[temp].vert2].a;
		pt3c = modelpipe.Pipe(vertexlist[trilist[temp].vert2]);//and here
		file << "\nVertex 3, transformed coord: " << pt3c.x << "," << pt3c.y << "," << pt3c.z;
		file << "\nVertex 3, transformed color: " << pt3c.r << "," << pt3c.g << "," << pt3c.b << "," << pt3c.a;

		temp++;
	}
	file.close();

}
 
Now, the interesting thing is... when I do a similar routine for the render, no problemo.
int c4Model::RenderMe()
{
	
	int temp = 0;
	c3PointC pt3c;

	//local2world. Move all points to world coord
	Local2World();

	//current rendermode is wireframe.
	e2a.SendRenderMode(E2A::Wireframe);

	e2a.SendBegin();	//kick off the begin() in the api.

	//loops thru the number of tris;
	while(temp < header.numtris)
	{
		pt3c = modelpipe.Pipe(vertexlist[trilist[temp].vert0]);
	//	e2a.SendColor(pt3c.GetColor());
		e2a.Send3Point(pt3c.GetPos());

		pt3c = modelpipe.Pipe(vertexlist[trilist[temp].vert1]);
	//	e2a.SendColor(pt3c.GetColor());
		e2a.Send3Point(pt3c.GetPos());

		pt3c = modelpipe.Pipe(vertexlist[trilist[temp].vert2]);
	//	e2a.SendColor(pt3c.GetColor());
		e2a.Send3Point(pt3c.GetPos());

		temp++;
	}
	e2a.SendEnd();

	World2Local();
	return true;
}
 
This code works great. Bugle4d

Share this post


Link to post
Share on other sites
Advertisement
Admin,just waste this thread, please.
EVerybody else...soryy...unrelated issue caused it.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!