From: Alex Schmidt Date: Wed, 20 Feb 2013 13:19:55 +0000 (+0100) Subject: ... X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/commitdiff_plain/870fa143f6a703e4f4432097ce8332ab3f15e4ad?hp=f9812559e766a409abfbd2d3bae519298339ab65 ... --- diff --git a/culooks.cpp b/culooks.cpp index a1f386f..647f7be 100644 --- a/culooks.cpp +++ b/culooks.cpp @@ -7,6 +7,7 @@ vector< pair > culooks::Windows; pthread_t culooks::glThreadId; +culooks::comarg culooks::comArg; int culooks::windowid = 0; @@ -42,14 +43,12 @@ culooks::culooks (const char* name, const int& xcubes, const int& ycubes, const Win->initialized = false; Windows.push_back( pair(0, Win) ); - + if (windowid == 0) { - comarg comArg; comArg.argc = argc; comArg.argv = argv; pthread_create(&glThreadId, 0, &drawing::glutThread, &comArg); } - mywid = windowid; windowid++; } @@ -99,3 +98,9 @@ void culooks::setBgColor(const float& red, const float& green, const float& blue Windows[mywid].second->bgcolor[2] = blue; Windows[mywid].second->bgcolor[3] = alpha; } + +void culooks::setWireColor(const float& r, const float& g, const float& b, const float& a) +{ + for (int icube=0; icubecubes.size(); icube++) + Windows[mywid].second->cubes[icube].setWireColor(r, g, b, a); +} diff --git a/culooks.h b/culooks.h index fe6ca11..3e47fde 100644 --- a/culooks.h +++ b/culooks.h @@ -27,6 +27,7 @@ class culooks void hideLinks(const int& cubeid); void hideLinks(); void setBgColor(const float& red, const float& green, const float& blue, const float& alpha); + void setWireColor(const float& r, const float& g, const float& b, const float& a); private: @@ -34,6 +35,8 @@ class culooks int *argc; char **argv; }; + + static comarg comArg; class cube { public: @@ -41,6 +44,7 @@ class culooks void draw(); int id; float az, alt; + float azRotSpeed; float zoom; void setLink (const int& posdir, const float& red, const float& green, const float& blue, const float& alpha); @@ -50,7 +54,9 @@ class culooks void swapPlaqBuffer(); void hidePlaqs(); void hideLinks(); + void setWireColor(const float& r, const float& g, const float& b, const float& a); private: + float wireColor[4]; void drawAll(); void drawBox(); static void drawFrame(); @@ -62,6 +68,8 @@ class culooks int plaqbuf_active; int linkbuf_active; static int allid; + bool hideplaquettes; + bool hidelinks; }; struct window { diff --git a/culooks_cube.cpp b/culooks_cube.cpp index a1d0744..2bf8804 100644 --- a/culooks_cube.cpp +++ b/culooks_cube.cpp @@ -2,6 +2,13 @@ #include +#include +#include + +using namespace std; + +using namespace std; + int culooks::cube::allid = 0; void culooks::cube::setLink (const int& posdir, @@ -22,24 +29,12 @@ void culooks::cube::setPlaq (const int& posdir, void culooks::cube::hidePlaqs() { - for (int ibuf=0; ibuf<2; ibuf++) - for (int i=0; ibgcolor[0], Win->bgcolor[1], Win->bgcolor[2], Win->bgcolor[3]); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); @@ -119,13 +119,13 @@ void culooks::drawing::displayFunc() void culooks::drawing::initWindow(int winid) { - glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH); + glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH); glutInitWindowSize(culooks::Windows[winid].second->w, culooks::Windows[winid].second->h); glutInitWindowPosition(winid*100,winid*100); glutCreateWindow( ("culooks / " + culooks::Windows[winid].second->name).c_str() ); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); @@ -161,7 +161,6 @@ void culooks::drawing::idleFunc() void* culooks::drawing::glutThread(void *_comArg) { comarg *comArg = (comarg*)_comArg; - glutInit(comArg->argc, comArg->argv); initWindow(0); glutMainLoop();