X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/d65d20475798a9e7614e61c46c68a2b77760d4c2..578c48ada63a6ea4f090728cf2b267fb3a731b78:/culooks.cpp?ds=sidebyside diff --git a/culooks.cpp b/culooks.cpp index d189c86..94b9aa9 100644 --- a/culooks.cpp +++ b/culooks.cpp @@ -1,13 +1,13 @@ #include "culooks.h" #include -#include #include #include vector< pair > culooks::Windows; pthread_t culooks::glThreadId; +culooks::comarg culooks::comArg; int culooks::windowid = 0; @@ -18,10 +18,7 @@ culooks::culooks (const char* name, const int& xcubes, const int& ycubes, const window *Win = new window; int winsize[2]; - if (windowid == 0) { - glutInit(argc, argv); - glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH); - } + XInitThreads(); Win->layout[0] = xcubes; Win->layout[1] = ycubes; @@ -47,14 +44,79 @@ culooks::culooks (const char* name, const int& xcubes, const int& ycubes, const Win->initialized = false; + //Win->linewidth = 1; + Windows.push_back( pair(0, Win) ); - + if (windowid == 0) { - glXMakeCurrent(0,0,0); - pthread_create(&glThreadId, 0, &drawing::glutThread, NULL); + comArg.argc = argc; + comArg.argv = argv; + pthread_create(&glThreadId, 0, &drawing::glutThread, &comArg); } - mywid = windowid; windowid++; } +void culooks::setLink (const int& cubeid, const int& posdir, + const float& red, const float& green, const float& blue, const float& alpha) +{ + Windows[mywid].second->cubes[cubeid].setLink(posdir, red, green, blue, alpha); +} + +void culooks::setPlaq (const int& cubeid, const int& posdir, + const float& red, const float& green, const float& blue, const float& alpha) +{ + Windows[mywid].second->cubes[cubeid].setPlaq(posdir, red, green, blue, alpha); +} + +void culooks::swapBuffers () { + for (int icube=0; icubecubes.size(); icube++) { + Windows[mywid].second->cubes[icube].swapLinkBuffer(); + Windows[mywid].second->cubes[icube].swapPlaqBuffer(); + } + Windows[mywid].second->redisplay = true; +} + +void culooks::hidePlaqs (const int& cubeid) { + Windows[mywid].second->cubes[cubeid].hidePlaqs(); +} + +void culooks::hidePlaqs () { + for (int icube=0; icubecubes.size(); icube++) + Windows[mywid].second->cubes[icube].hidePlaqs(); +} + +void culooks::hideLinks (const int& cubeid) { + Windows[mywid].second->cubes[cubeid].hideLinks(); +} + +void culooks::hideLinks () { + for (int icube=0; icubecubes.size(); icube++) + Windows[mywid].second->cubes[icube].hideLinks(); +} + +void culooks::setBgColor(const float& red, const float& green, const float& blue, const float& alpha) +{ + Windows[mywid].second->bgcolor[0] = red; + Windows[mywid].second->bgcolor[1] = green; + 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); +} + +void culooks::setFrameWidth(float width) +{ + for (int icube=0; icubecubes.size(); icube++) + Windows[mywid].second->cubes[icube].setFrameWidth(width); +} + +void culooks::setLinkWidth(float width) +{ + for (int icube=0; icubecubes.size(); icube++) + Windows[mywid].second->cubes[icube].setLinkWidth(width); +}