Hi
I am trying to create a line with start/end coordinates (x0,y0,x1,y1),
width and colour by using a vgui_soview2D_lineseg object.
Unfortunately I am getting a Segmentation fault in the library
libvgui.so as soon as I call the functions
vgui_soview::set_line_width(float)
vgui_soview::set_colour(float, float, float)
bevore(!) I add the vgui_soview2D_lineseg to the vgui_easy2D_tableau.
Does someone may know better, how to use a vgui_soview2D_lineseg object?
Is this a bug?
Finally I would like to create a group of lines (all with different
colors and coordinates) in a vgui_soview2D_group obbject.
Thanks for any help.
Daniel
-------------------------------------------
Here some example code:
If I exchange the "interesting code" with this one it works, but only
for one single line.
/******interesting code starts here (working)********/
vgui_soview2D_lineseg* line1= new vgui_soview2D_lineseg();
line1->x0=100;
line1->y0=40;
line1->x1=140;
line1->y1=90;
easy2D->add(line1);
line1->set_line_width(8.0);
line1->set_colour(.1, 1, .4);
/******interesting code ends here********/
----------------------------------------------
#include <vcl_iostream.h>
#include <vgui/vgui.h>
#include <vgui/vgui_image_tableau.h>
#include <vgui/vgui_easy2D_tableau.h>
#include <vgui/vgui_viewer2D_tableau.h>
#include <vgui/vgui_shell_tableau.h>
#include <vgui/vgui_soview2D.h>
int main(int argc, char **argv)
{
vgui::init(argc, argv);
// Load an image into an image.tableau
vgui_image_tableau_new image;
// Put the image.tableau into a easy2D tableau
vgui_easy2D_tableau_new easy2D(image);
/******interesting code starts here (not working)********/
vgui_soview2D_lineseg* line1= new vgui_soview2D_lineseg();
line1->x0=100;
line1->y0=40;
line1->x1=140;
line1->y1=90;
line1->set_line_width(8.0);
line1->set_colour(.1, 1, .4);
easy2D->add(line1);
/******interesting code ends here********/
// Put the easy2D tableau into a viewer2D tableau:
vgui_viewer2D_tableau_new viewer(easy2D);
vgui_shell_tableau_new shell(viewer);
// Create a window, add the tableau and show it on screen:
return vgui::run(shell, 300,300);
}
|