#include "culooks.h"
#include <vector>
-#include <GL/glut.h>
-#include <GL/glx.h>
-#include <GL/gl.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
#include <iostream>
#include <math.h>
vector< pair<int,culooks::window*> > culooks::Windows;
pthread_t culooks::glThreadId;
+culooks::comarg culooks::comArg;
int culooks::windowid = 0;
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;
Win->initialized = false;
Windows.push_back( pair<int,culooks::window*>(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; icube<Windows[mywid].second->cubes.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; icube<Windows[mywid].second->cubes.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; icube<Windows[mywid].second->cubes.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; icube<Windows[mywid].second->cubes.size(); icube++)
+ Windows[mywid].second->cubes[icube].setWireColor(r, g, b, a);
+}