X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/0f815d3fea69adf1ee22cff3a728a4c22cf6e466..863c9da2356ce3fc92d6a39550ac6c181252781a:/culooks.cpp?ds=inline diff --git a/culooks.cpp b/culooks.cpp index 19e6077..94b9aa9 100644 --- a/culooks.cpp +++ b/culooks.cpp @@ -1,17 +1,13 @@ #include "culooks.h" #include -#include -#include -#include -#include -#include #include #include vector< pair > culooks::Windows; pthread_t culooks::glThreadId; +culooks::comarg culooks::comArg; int culooks::windowid = 0; @@ -22,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; @@ -51,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); +}