X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/2c7ea0058473eb98219ff87c64e28f31fac34b90..37439b2f85687ddafa4097d07237fc17a0a6db0d:/culooks.cpp diff --git a/culooks.cpp b/culooks.cpp index fe8fd00..cb5eda7 100644 --- a/culooks.cpp +++ b/culooks.cpp @@ -1,5 +1,12 @@ #include "culooks.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -8,94 +15,8 @@ pthread_t culooks::glThreadId; int culooks::windowid = 0; -int culooks::cube::allid = 0; - using namespace std; -void culooks::cube::draw() -{ - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - //cout << zoom << endl; - - glScalef(zoom, zoom, zoom); - glRotatef(az, 0, 1, 0); - glRotatef(alt, 1, 0, 0); - - /* - glBegin(GL_QUADS); - glVertex2f(-1, -1); glVertex2f(1, -1); glVertex2f(1, 1); glVertex2f(-1, 1); - glEnd(); - */ - - //drawBox(); - drawAll(); - - glPopMatrix(); -} - -void culooks::cube::drawAll() -{ - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - glTranslatef(-1,-1,-1); - - for (int iz=0; izcubes.at(rotcube[0]).az += rotcube[1] - x; @@ -186,7 +107,7 @@ namespace mygl static void displayFunc() { - cout << ":" << glutGetWindow() << endl; + //cout << ":" << glutGetWindow() << endl; culooks::window *Win = getWin(); @@ -240,10 +161,8 @@ namespace mygl initWindow(iwin); } - static void* glutThread(void *_wincon) + static void* glutThread(void *leer) { - culooks::wincontext *wincon = (culooks::wincontext *)_wincon; - glXMakeCurrent( wincon->gDisplay, wincon->gDrawable, wincon->gContext ); initWindow(0); glutIdleFunc(&idleFunc_master); glutMainLoop(); @@ -289,32 +208,11 @@ culooks::culooks (const char* name, const int& xcubes, const int& ycubes, const Windows.push_back( pair(0, Win) ); if (windowid == 0) { - wincon.gContext = glXGetCurrentContext(); - wincon.gDisplay = glXGetCurrentDisplay(); - wincon.gDrawable = glXGetCurrentDrawable(); - glXMakeCurrent(0,0,0); - - pthread_create(&glThreadId, 0, &mygl::glutThread, &wincon); + pthread_create(&glThreadId, 0, &mygl::glutThread, NULL); } mywid = windowid; windowid++; } -culooks::cube::cube(int _l) -{ - l = _l; - link = new float[l*l*l*3 * 4]; - plaq = new float[l*l*l*3 * 4]; - az = 30; - alt = -20; - zoom = 0.6; - id = allid; - allid++; - - for (int i=0; i