X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/d65d20475798a9e7614e61c46c68a2b77760d4c2..f9812559e766a409abfbd2d3bae519298339ab65:/culooks.cpp diff --git a/culooks.cpp b/culooks.cpp index d189c86..a1f386f 100644 --- a/culooks.cpp +++ b/culooks.cpp @@ -1,7 +1,6 @@ #include "culooks.h" #include -#include #include #include @@ -18,11 +17,6 @@ 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); - } - Win->layout[0] = xcubes; Win->layout[1] = ycubes; Win->aspect = (double)xcubes/ycubes; @@ -50,11 +44,58 @@ culooks::culooks (const char* name, const int& xcubes, const int& ycubes, const Windows.push_back( pair(0, Win) ); if (windowid == 0) { - glXMakeCurrent(0,0,0); - pthread_create(&glThreadId, 0, &drawing::glutThread, NULL); + comarg comArg; + 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; +}