Thanks for the help, but now i have another problem. I am trying to add my polygon to a GeomNode, and I have this problem.
snode.add_geom(mySquare);
my compiler breaks at that point. I have converted all my pointers pertaining to the ones specified to PT(). Im unclear as to the source of this problem. If you would need to know, the code for all my procedural modeling is below. Also, where can I find Panda3D’s Inheritance tree? Help is much appreciated.
GeomVertexData vData( "Square",GeomVertexFormat::get_v3n3c4t2(),Geom::UH_dynamic);
GeomVertexWriter vertex(&vData,"Vertex");
GeomVertexWriter color(&vData, "color");
GeomVertexWriter normal(&vData, "normal");
GeomVertexWriter textures(&vData,"TexCoord");
if (x1!= x2)
{
vertex.add_data3f(x1,y1,z1);
vertex.add_data3f(x2,y1,z1);
vertex.add_data3f(x2,y2,z2);
vertex.add_data3f(x1,y2,z2);
normal.add_data3f(0,0,0);
normal.add_data3f(0,0,0);
normal.add_data3f(0,0,0);
normal.add_data3f(0,0,0);
}
else
{
vertex.add_data3f(x1, y1, z1);
vertex.add_data3f(x2, y2, z1);
vertex.add_data3f(x2, y2, z2);
vertex.add_data3f(x1, y1, z2);
normal.add_data3f(0,0,0);
normal.add_data3f(0,0,0);
normal.add_data3f(0,0,0);
normal.add_data3f(0,0,0);//dummy values
}
PT(GeomTriangles) Tri1;
Tri1 = new GeomTriangles(Geom::UH_dynamic);
Tri1->add_vertex(0);
Tri1->add_vertex(1);
Tri1->add_vertex(3);
color.add_data4f(1.0,0.0,0.0,1.0);
color.add_data4f(0.0,1.0,0.0,1.0);
color.add_data4f(0.0,0.0,1.0,1.0);
color.add_data4f(1.0,0.0,1.0,1.0);
textures.add_data2f(0.0, 1.0);
textures.add_data2f(0.0, 0.0);
textures.add_data2f(1.0, 0.0);
textures.add_data2f(1.0, 1.0);
PT(Geom) mySquare;
mySquare = new Geom(&vData);
mySquare->add_primitive((GeomPrimitive *)Tri1);
GeomNode snode("square");
snode.add_geom(mySquare);