]> git.tdb.fi Git - netvis.git/blobdiff - source/port.cpp
Handle ICMP packets
[netvis.git] / source / port.cpp
index 5c0bfa62435634892f970f282887e8ef006b41a8..678be06e991bdfb4dce3bbd31f88c36732795cbd 100644 (file)
@@ -37,7 +37,7 @@ Port::Port(NetVis &v, unsigned n):
                registered = !isdigit(name[0]);
        }
        else
-               name = Msp::lexical_cast(number);
+               name = Msp::lexical_cast<string>(number);
 
        const map<unsigned, Port *> &ports = netvis.get_ports();
        unsigned tries = 100;
@@ -92,6 +92,11 @@ Port::Port(NetVis &v, unsigned n):
        bld.end();
 }
 
+void Port::set_name(const string &n)
+{
+       name = n;
+}
+
 void Port::add_activity(unsigned bytes)
 {
        activity.add_bytes(bytes);
@@ -104,7 +109,7 @@ void Port::tick(const Time::TimeDelta &dt)
 
 void Port::render() const
 {
-       GL::PushMatrix push_;
+       GL::MatrixStack::Push push_(GL::MatrixStack::modelview());
        mesh.draw();
        {
                GL::Immediate imm((GL::COLOR4_UBYTE, GL::VERTEX2));
@@ -117,11 +122,8 @@ void Port::render() const
                imm.vertex(14, 10);
                imm.end();
        }
-       GL::translate(16, 1, 0);
-       GL::scale_uniform(10);
-       {
-               GL::Immediate imm((GL::COLOR4_UBYTE, GL::TEXCOORD2, GL::VERTEX2));
-               netvis.get_font().draw_string(name, imm);
-       }
+       GL::MatrixStack::modelview() *= GL::Matrix::translation(16, 1, 0);
+       GL::MatrixStack::modelview() *= GL::Matrix::scaling(10);
+       netvis.get_font().draw_string(name);
        GL::Texture::unbind();
 }