#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
-#include <msp/core/except.h>
+#include <msp/core/getopt.h>
#include <msp/debug/profilingscope.h>
#include <msp/gl/blend.h>
#include <msp/gl/framebuffer.h>
#include <msp/gl/projection.h>
#include <msp/gl/texture2d.h>
#include <msp/gl/transform.h>
-#include <msp/strings/formatter.h>
+#include <msp/strings/format.h>
#include <msp/time/units.h>
#include <msp/time/utils.h>
#include "history.h"
frames(0)
{
if(argc<2)
- throw UsageError("No interface given");
+ throw usage_error("No interface given");
iface = argv[1];
char err[1024];
pcap = pcap_open_live(iface.c_str(), 128, true, 0, err);
if(!pcap)
- throw Exception(err);
+ throw runtime_error(err);
if(pcap_setnonblock(pcap, true, err)==-1)
- throw Exception(err);
+ throw runtime_error(err);
pcap_lookupnet(iface.c_str(), &localnet, &localnet_mask, err);
localnet = ntohl(localnet);
wnd->signal_close.connect(sigc::bind(sigc::mem_fun(this, &NetVis::exit), 0));
wnd->show();
- GL::enable(GL::BLEND);
- GL::blend_func(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA);
+ GL::Blend::alpha().bind();
font = new GL::Font;
DataFile::load(*font, "dejavu-10.font");
void NetVis::render()
{
- GL::clear(GL::COLOR_BUFFER_BIT);
+ GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT);
- GL::matrix_mode(GL::PROJECTION);
- GL::load_identity();
- GL::ortho_centered(1024, 768);
- GL::matrix_mode(GL::MODELVIEW);
- GL::load_identity();
+ GL::MatrixStack::projection() = GL::Matrix::ortho_centered(1024, 768);
+ GL::MatrixStack::modelview() = GL::Matrix();
for(map<unsigned, Host *>::iterator i=hosts.begin(); i!=hosts.end(); ++i)
i->second->render();
imm.end();
}
- GL::push_matrix();
- GL::translate(-500, 360, 0);
+ GL::MatrixStack::modelview() = GL::Matrix::translation(-500, 360, 0);
unsigned n = 0;
for(map<unsigned, Port *>::iterator i=ports.begin(); (i!=ports.end() && n<50); ++i)
{
if((i->second->is_registered() && act>1) || act>200)
{
i->second->render();
- GL::translate(0, -12, 0);
+ GL::MatrixStack::modelview() *= GL::Matrix::translation(0, -12, 0);
++n;
}
}
- GL::pop_matrix();
- GL::push_matrix();
- GL::translate(-500, -348, 0);
- GL::scale_uniform(10);
+ GL::MatrixStack::modelview() = GL::Matrix::translation(-500, -348, 0);
+ GL::MatrixStack::modelview() *= GL::Matrix::scaling(10);
font->draw_string(format("%d hosts", hosts.size()+disabled_hosts.size()));
- GL::translate(0, -1.2, 0);
+ GL::MatrixStack::modelview() *= GL::Matrix::translation(0, -1.2, 0);
font->draw_string(format("%d ports", ports.size()));
- GL::translate(0, -1.2, 0);
+ GL::MatrixStack::modelview() *= GL::Matrix::translation(0, -1.2, 0);
font->draw_string(format("%.2f fps", fps));
GL::Texture::unbind();
- GL::pop_matrix();
- GL::push_matrix();
- GL::translate(170, -370, 0);
+ GL::MatrixStack::modelview() = GL::Matrix::translation(170, -370, 0);
history->render();
- GL::pop_matrix();
}
Host &NetVis::get_host(unsigned a)
{
exit(0);
}
-
-Application::RegApp<NetVis> NetVis::reg;