Render lines between nodes in c
by Imm Dtu · in Torque Game Engine · 10/28/2005 (8:13 am) · 1 replies
Hey,
I'm doing some pathfinding and looking for a way to illustrate my graph (nodes and egdes). I have tried to add a function in GuiEditCtrl.cc called drawLineNodes, but so far it does not work. I call this function from the script code: (the funtion call works) So far the points are hardcoded, but the plan is obviously to call the function with nodes from our graph.
void GuiEditCtrl::drawLinesNodes()
{
Point3F start, end;
start.set(2, 3 , 300);
end.set(202, 303 , 301);
// Draw points
glBegin(GL_POINTS);
glColor3f(1.0,0.0,0.0); // red for the dots
glVertex3f(start.x, start.y, start.z);
glVertex3f(end.x, end.y, end.z);
glEnd();
// Draw line
glLineWidth(0.5);
glBegin(GL_LINES);
glColor3f(0.0,1.0,0.0); // green for the lines
glVertex3f(start.x, start.y, start.z);
glVertex3f(end.x, end.y, end.z);
glEnd();
}
I am not sure the function is in the right/optimal class. If anyone can help out or have some code that does the trick feel free to post :o)
/IMM
I'm doing some pathfinding and looking for a way to illustrate my graph (nodes and egdes). I have tried to add a function in GuiEditCtrl.cc called drawLineNodes, but so far it does not work. I call this function from the script code: (the funtion call works) So far the points are hardcoded, but the plan is obviously to call the function with nodes from our graph.
void GuiEditCtrl::drawLinesNodes()
{
Point3F start, end;
start.set(2, 3 , 300);
end.set(202, 303 , 301);
// Draw points
glBegin(GL_POINTS);
glColor3f(1.0,0.0,0.0); // red for the dots
glVertex3f(start.x, start.y, start.z);
glVertex3f(end.x, end.y, end.z);
glEnd();
// Draw line
glLineWidth(0.5);
glBegin(GL_LINES);
glColor3f(0.0,1.0,0.0); // green for the lines
glVertex3f(start.x, start.y, start.z);
glVertex3f(end.x, end.y, end.z);
glEnd();
}
I am not sure the function is in the right/optimal class. If anyone can help out or have some code that does the trick feel free to post :o)
/IMM
Torque Owner Diesel
Default Studio Name
www.garagegames.com/mg/forums/result.thread.php?qt=3712