From f9a5eaa29f5b836cf87a82422c5d97f5378d9935 Mon Sep 17 00:00:00 2001 From: Gabriel Dunne Date: Thu, 31 Dec 2009 19:37:07 -0800 Subject: [PATCH] long --- intern/Global.cpp | 72 +- intern/Global.h | 2 + intern/Thingy.cpp | 8 +- intern/jttoolkit.cpp | 2 +- media/move.txt | 17880 ++++++++++++++++++++++++++++++----------- 5 files changed, 13334 insertions(+), 4630 deletions(-) diff --git a/intern/Global.cpp b/intern/Global.cpp index 0088d85..4908bf0 100755 --- a/intern/Global.cpp +++ b/intern/Global.cpp @@ -27,22 +27,22 @@ Global::Global() thingies.back()->z = ((rnd[i+7] - .5) * 100000000); } - - + + movecount = 0; - //toggleFullScreen(); - //hideMouse(); - - ifstream infile("media/move.txt"); - while( infile.good() ) { - int p; - infile >> p; - move.push_back(p); - } - - - cout << move.size() << endl; - + toggleFullScreen(); + hideMouse(); + + + ifstream infile("media/move.txt"); + while( infile.good() ) { + int p; + infile >> p; + move.push_back(p); + } + + cout << move.size() << endl; + } @@ -56,10 +56,9 @@ void Global::loop() vector::iterator it; int MPOS = move[movecount]; - - if (movecount != move.size() + 1000) { - movecount++; + if (movecount < move.size() - 10) { + movecount++; } else { rnd.clear(); @@ -75,24 +74,20 @@ void Global::loop() (*it)->z = ((rnd[cnt+7] - .5) * 100000000); cnt++; } - movecount = 0; + movecount = 0; } - + + +// int MPOS = mouseX(); +// capture.push_back(mouseX()); + + for(int i=0; ix = rnd[i] * width(); thingies[i]->y = rnd[i+3] * height(); - - // position - - float ddd = .01; - if (movecount > 3000) { - ddd = .005; - } - - thingies[i]->z += (( MPOS - (width() / 2)) * ddd); - + thingies[i]->z += (( MPOS - (800 / 2)) * .01); thingies[i]->step(); thingies[i]->draw(); } @@ -110,10 +105,6 @@ void Global::loop() (*it)->glVertex(); } glEnd(); - - - //cout << mouseX() << ",\n"; - } @@ -128,7 +119,16 @@ void Global::keyDown(int k, int special) void Global::mouseDown() { -/* + int c = 0; + cout << "++++++++" << endl; + for(int i = 0; i < capture.size(); i++) + { + cout << capture[i] << endl; + } +// cout << capture.size() << endl; + + +/* rnd.clear(); for(int i=0;i<1000;i++){ rnd.push_back(randomFloat()); @@ -142,7 +142,7 @@ void Global::mouseDown() (*it)->z = ((rnd[cnt+7] - .5) * 100000000); cnt++; } - */ + */ } diff --git a/intern/Global.h b/intern/Global.h index e052019..5d572de 100755 --- a/intern/Global.h +++ b/intern/Global.h @@ -29,6 +29,8 @@ class Global{ int movecount; vector move; + vector capture; + void loop(); void keyDown(int k,int special); void mouseDown(); diff --git a/intern/Thingy.cpp b/intern/Thingy.cpp index a5f3e45..3c3f7d8 100644 --- a/intern/Thingy.cpp +++ b/intern/Thingy.cpp @@ -54,11 +54,11 @@ void Thingy::step(){ // (*this)+=JPoint( randomFloat()-0.5, randomFloat()-0.5, randomFloat()-0.5); - size += (destSize - size) * 0.005; + size += (destSize - size) * 0.0002; - float xx = (dest.x-x) * .0045; - float yy = (dest.y-y) * .0045; - float zz = (dest.z-z) * .0045; + float xx = (dest.x-x) * .0045 / 3.5; + float yy = (dest.y-y) * .0045 / 3.5; + float zz = (dest.z-z) * .0045 / 3.5; x += xx; y += yy; diff --git a/intern/jttoolkit.cpp b/intern/jttoolkit.cpp index 42497b5..047c601 100755 --- a/intern/jttoolkit.cpp +++ b/intern/jttoolkit.cpp @@ -1 +1 @@ -#include "jttoolkit.h" #include #include #include #include #include #define INIT_WINDOW_X 0 #define INIT_WINDOW_Y 0 #define INIT_WINDOW_WIDTH 1024 #define INIT_WINDOW_HEIGHT 768 //#include "gl2ps.h" #if defined (__DARWIN__) #include #endif #define use_perspective #define VERBOSE 0 //turn this on and off for speed //---- user-global access functions int ticks(){return _ticks;} int width(){return _width;} int height(){return _height;} int mouseX(){return _mouseX;} int mouseY(){return _mouseY;} void setMouseX(long xx){_mouseX = xx;} void setMouseY(long yy){_mouseY = yy;} void ignoreMouse(int state){_ignoreMouse = state;} //-------------- void *threadFunc(void*stuff){ } //------------------------------------------------------------------------ void initfmod(){ /* if (FSOUND_GetVersion() < FMOD_VERSION){ printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); exit(1); } if(!FSOUND_Init(48000, 1024, FSOUND_INIT_GLOBALFOCUS)){ printf("%s\n",FMOD_ErrorString(FSOUND_GetError())); } */ } //------------------------------------------------------------------------ float friction(){return _friction;} void setFriction(float f){_friction = f;} float frequencyRange(){return _frequencyRange;} void setFrequencyRange(float f){_frequencyRange = f;} void drawUnitSquare(){ glBegin(GL_QUADS); glTexCoord2f(0,0);glVertex2f(0,0); glTexCoord2f(1,0);glVertex2f(1,0); glTexCoord2f(1,1);glVertex2f(1,1); glTexCoord2f(0,1);glVertex2f(0,1); glEnd(); } void drawUnitSquareSlightlySmaller(){ glBegin(GL_QUADS); glTexCoord2f(0.01,0.01);glVertex2f(0,0); glTexCoord2f(0.99,0.01);glVertex2f(1,0); glTexCoord2f(0.99,0.99);glVertex2f(1,1); glTexCoord2f(0.01,0.99);glVertex2f(0,1); glEnd(); } void toggleFullScreen(){ fullscreenmode=!fullscreenmode; if(fullscreenmode){ glutFullScreen(); } else { glutReshapeWindow(INIT_WINDOW_WIDTH,INIT_WINDOW_HEIGHT); glutPositionWindow(0,10); } } char* trimLeft(char*buff){ //count how many to offset backward int whiteCount = 0; for(int i=0;i0){ for(int b=0;b frameRate){ _execute_frame(); lastGlutFrameTime = glutGet(GLUT_ELAPSED_TIME); } */ } void timerFunc(int v) { //if(glutGet(GLUT_ELAPSED_TIME) - lastGlutFrameTime > frameRate){ _execute_frame(); //} glutTimerFunc(frameRate,timerFunc,0); } void preKeyDown(unsigned char k, int special){ if(special){ if(k==11){ toggleFullScreen(); } } else { //non special if(k==27){ //exit(0); }else if (k==KEY_DELETE || k==KEY_BACKSPACE){ } else if (k==6){//ctrl+f on a mac toggleFullScreen(); } else { } } } void keyboardDown(unsigned char k,int x,int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; } preKeyDown(k,0); jttoolkit_keyDown(k,0); } void keyboardUp(unsigned char k,int x,int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; } //printf("keyboardUp: %c %i\n",k); jttoolkit_keyUp(k,0); } void specialFunc(int k,int x,int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; } preKeyDown(k,1); jttoolkit_keyDown(k,1); } void mouseMotionFunc(int x, int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; }else{ ignored_mouseMove(x,y); } } void mousePassiveMotionFunc(int x, int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; }else{ ignored_mouseMove(x,y); } // printf("%i %i\n",_mouseX,_mouseY); } void mouseFunc(int button, int state, int x, int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; if(state==GLUT_DOWN){ jttoolkit_mouseDown(); } else { jttoolkit_mouseUp(); } }else{ if(state==GLUT_DOWN){ ignored_mouseDown(x,y); } else { ignored_mouseUp(x,y); } } } void viewPerspective(float angle){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(angle,(float)width()/(float)height(),0.0001,10000); //glFrustum(-2, 2, -2, 2, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); } void viewOrtho(){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,width(),-height(),0,-10000,10000); glMatrixMode(GL_MODELVIEW); } void reshape(int w,int h){ // if(glutGetWindow()==MainWindowID){ if(1){ _width = w; _height = h; // to keep it propertional & let the window stretch // glMatrixMode(GL_PROJECTION); // glLoadIdentity(); glViewport(0,0,w,h); // if(wdraw(); viewPerspective(90); glLoadIdentity(); } else { //then i can assume for now that it was the output console window. glViewport(0,0,w,h); float r = ((float)w/(float)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //#if defined(use_perspective) //gluPerspective(90,(float)w/(float)h,0.0001,10000); //#else glOrtho(0,w,h,0,-10000,10000); //#endif //glFrustum(-2, 2, -2, 2, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } // jt_resizeDrawBuffer(); } void jt_resizeDrawBuffer(){ // delete [] drawbuffer; // drawbuffer = new unsigned char[width()*height()*4]; } int main(int argc,char** argv){ glutInit(&argc,argv); glutInitDisplayMode (GLUT_DOUBLE|GLUT_RGBA); glutInitWindowSize (INIT_WINDOW_WIDTH,INIT_WINDOW_HEIGHT); glutInitWindowPosition (INIT_WINDOW_X,INIT_WINDOW_Y); int gameMode = 0; if(argc>1){ for(int i=0;ipush((long)p); } void JTTessEnd(){ //FLUSH IT! tobj = gluNewTess(); _tessBind(); if(tesscache!=0){ gluTessBeginPolygon(tobj,NULL); gluTessBeginContour(tobj); for(int i=tessBase;icount ;i++){ // long t = tesscache->get(i); // switch(t){ // case TESSCACHE_NEWCONTOUR:break; // default: //printf("%i\n",t); //printf("%i\n",((GLdouble*)(t))[0]); //delete [] (GLdouble*)t;//i'm leaving this all in memory, but it's dangerous! //tessfreemem->push(t); //break; // } //} //delete tesscache; //tesscache = new Vector(); } else { //it WAS zero. //tesscache = new Vector(); } tessBase += tessPtr;//advance forward. tessPtr = 0; */ } void doTessErrorCheck(){ if(tessPtr+tessBase>tessmax){ printf("error:not enough memory allocated to JTTess",0); exit(0); } } void _tessBind(){ //#if defined (__DARWIN__) //#define TESSTYPE (GLvoid (*)(...)) //#else //typedef GLvoid ( *GluTessCallbackType)(...); //#define TESSTYPE reinterpret_cast //#endif /* gluTessCallback(tobj, GLU_TESS_VERTEX, TESSTYPE(glVertex3dv)); gluTessCallback(tobj, GLU_TESS_BEGIN, TESSTYPE(JTTess_beginCallback)); gluTessCallback(tobj, GLU_TESS_END, TESSTYPE(&JTTess_endCallback)); gluTessCallback(tobj, GLU_TESS_ERROR, TESSTYPE(JTTess_errorCallback)); gluTessCallback(tobj, GLU_TESS_COMBINE, TESSTYPE(JTTess_combineCallback)); gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE); */ } /* the callback routines registered by gluTessCallback() */ void JTTESSCALLBACK JTTess_combineCallback(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut ){ GLdouble *vertex; int i; doTessErrorCheck(); vertex = tesscache[tessBase+tessPtr];//(GLdouble *) malloc(6 * sizeof(GLdouble)); tessPtr++; vertex[0] = coords[0]; vertex[1] = coords[1]; vertex[2] = coords[2]; for (i = 3; i < 7; i++) vertex[i] = weight[0] * vertex_data[0][i] + weight[1] * vertex_data[1][i] + weight[2] * vertex_data[2][i] + weight[3] * vertex_data[3][i]; *dataOut = vertex; } void JTTESSCALLBACK JTTess_beginCallback(GLenum which){ glBegin(which); } void JTTESSCALLBACK JTTess_endCallback(void) { glEnd(); } void JTTESSCALLBACK JTTess_errorCallback(GLenum errorCode) { const GLubyte *estring; estring = gluErrorString(errorCode); fprintf (stderr, "Tessellation Error: %s\n", estring); exit (0); } /* new callback routines registered by these calls */ void JTTESSCALLBACK JTTess_vertexCallback(GLvoid *vertex){ const GLdouble *pointer; pointer = (GLdouble *) vertex; glColor3dv(pointer+3); glVertex3dv((const GLdouble*)vertex); } JoshFont *getFont(){ return font; } JPoint mouse(){ return JPoint(mouseX(),mouseY(),0); } /** saves the screen to a file. format support provided by image magick. supported formats: http://www.imagemagick.org/script/formats.php */ void saveScreen(char *filename){ using namespace Magick; if(rawpixels==NULL){ rawpixels = new unsigned char[width()*height()*3]; } glReadPixels(0,0,width(),height(), GL_RGB , GL_UNSIGNED_BYTE ,rawpixels); /* //reverse the alpha vals. for(int i=0;iflip(); return image; } /* allocates new storage for an 8-bit image of the specified dimensions */ png_bytep* make_pixels(int width, int height) { int pixel_size = 3; //printf("debug debug debug 1\n",0); png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { return NULL; } //printf("debug debug debug 2\n",0); png_bytep *row_pointers = (unsigned char **)png_malloc(png_ptr, height*sizeof(png_bytep)); for (int i = 0; i < height; i++) row_pointers[i] = (unsigned char *)png_malloc(png_ptr, width*pixel_size); //printf("debug debug debug 3\n",0); return row_pointers; } //-------------------------------------------------------------------------------------------- void jt_frameRate(unsigned long f){ frameRate = f; } void roundedRect(int gl_style,float x1,float y1,float x2,float y2,float radius,int steps){ float inc = (PI*0.5)/steps; glBegin(gl_style); //draw a quarter circle here. for(int i=0;i #include #include #include #include #define INIT_WINDOW_X 0 #define INIT_WINDOW_Y 0 #define INIT_WINDOW_WIDTH 1024 #define INIT_WINDOW_HEIGHT 768 //#include "gl2ps.h" #if defined (__DARWIN__) #include #endif #define use_perspective #define VERBOSE 0 //turn this on and off for speed //---- user-global access functions int ticks(){return _ticks;} int width(){return _width;} int height(){return _height;} int mouseX(){return _mouseX;} int mouseY(){return _mouseY;} void setMouseX(long xx){_mouseX = xx;} void setMouseY(long yy){_mouseY = yy;} void ignoreMouse(int state){_ignoreMouse = state;} //-------------- void *threadFunc(void*stuff){ } //------------------------------------------------------------------------ void initfmod(){ /* if (FSOUND_GetVersion() < FMOD_VERSION){ printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); exit(1); } if(!FSOUND_Init(48000, 1024, FSOUND_INIT_GLOBALFOCUS)){ printf("%s\n",FMOD_ErrorString(FSOUND_GetError())); } */ } //------------------------------------------------------------------------ float friction(){return _friction;} void setFriction(float f){_friction = f;} float frequencyRange(){return _frequencyRange;} void setFrequencyRange(float f){_frequencyRange = f;} void drawUnitSquare(){ glBegin(GL_QUADS); glTexCoord2f(0,0);glVertex2f(0,0); glTexCoord2f(1,0);glVertex2f(1,0); glTexCoord2f(1,1);glVertex2f(1,1); glTexCoord2f(0,1);glVertex2f(0,1); glEnd(); } void drawUnitSquareSlightlySmaller(){ glBegin(GL_QUADS); glTexCoord2f(0.01,0.01);glVertex2f(0,0); glTexCoord2f(0.99,0.01);glVertex2f(1,0); glTexCoord2f(0.99,0.99);glVertex2f(1,1); glTexCoord2f(0.01,0.99);glVertex2f(0,1); glEnd(); } void toggleFullScreen(){ fullscreenmode=!fullscreenmode; if(fullscreenmode){ glutFullScreen(); } else { glutReshapeWindow(INIT_WINDOW_WIDTH,INIT_WINDOW_HEIGHT); glutPositionWindow(0,10); } } char* trimLeft(char*buff){ //count how many to offset backward int whiteCount = 0; for(int i=0;i0){ for(int b=0;b frameRate){ _execute_frame(); lastGlutFrameTime = glutGet(GLUT_ELAPSED_TIME); } */ } void timerFunc(int v) { //if(glutGet(GLUT_ELAPSED_TIME) - lastGlutFrameTime > frameRate){ _execute_frame(); //} glutTimerFunc(frameRate,timerFunc,0); } void preKeyDown(unsigned char k, int special){ if(special){ if(k==11){ toggleFullScreen(); } } else { //non special if(k==27){ //exit(0); }else if (k==KEY_DELETE || k==KEY_BACKSPACE){ } else if (k==6){//ctrl+f on a mac toggleFullScreen(); } else { } } } void keyboardDown(unsigned char k,int x,int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; } preKeyDown(k,0); jttoolkit_keyDown(k,0); } void keyboardUp(unsigned char k,int x,int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; } //printf("keyboardUp: %c %i\n",k); jttoolkit_keyUp(k,0); } void specialFunc(int k,int x,int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; } preKeyDown(k,1); jttoolkit_keyDown(k,1); } void mouseMotionFunc(int x, int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; }else{ ignored_mouseMove(x,y); } } void mousePassiveMotionFunc(int x, int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; }else{ ignored_mouseMove(x,y); } // printf("%i %i\n",_mouseX,_mouseY); } void mouseFunc(int button, int state, int x, int y){ if(!_ignoreMouse){ _mouseX=x; _mouseY=y; if(state==GLUT_DOWN){ jttoolkit_mouseDown(); } else { jttoolkit_mouseUp(); } }else{ if(state==GLUT_DOWN){ ignored_mouseDown(x,y); } else { ignored_mouseUp(x,y); } } } void viewPerspective(float angle){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(angle,(float)width()/(float)height(),0.0001,10000); //glFrustum(-2, 2, -2, 2, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); } void viewOrtho(){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0,width(),-height(),0,-10000,10000); glMatrixMode(GL_MODELVIEW); } void reshape(int w,int h){ // if(glutGetWindow()==MainWindowID){ if(1){ _width = w; _height = h; // to keep it propertional & let the window stretch // glMatrixMode(GL_PROJECTION); // glLoadIdentity(); glViewport(0,0,w,h); // if(wdraw(); viewPerspective(90); glLoadIdentity(); } else { //then i can assume for now that it was the output console window. glViewport(0,0,w,h); float r = ((float)w/(float)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //#if defined(use_perspective) //gluPerspective(90,(float)w/(float)h,0.0001,10000); //#else glOrtho(0,w,h,0,-10000,10000); //#endif //glFrustum(-2, 2, -2, 2, 1.0f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } // jt_resizeDrawBuffer(); } void jt_resizeDrawBuffer(){ // delete [] drawbuffer; // drawbuffer = new unsigned char[width()*height()*4]; } int main(int argc,char** argv){ glutInit(&argc,argv); glutInitDisplayMode (GLUT_DOUBLE|GLUT_RGBA); glutInitWindowSize (INIT_WINDOW_WIDTH,INIT_WINDOW_HEIGHT); glutInitWindowPosition (INIT_WINDOW_X,INIT_WINDOW_Y); int gameMode = 0; if(argc>1){ for(int i=0;ipush((long)p); } void JTTessEnd(){ //FLUSH IT! tobj = gluNewTess(); _tessBind(); if(tesscache!=0){ gluTessBeginPolygon(tobj,NULL); gluTessBeginContour(tobj); for(int i=tessBase;icount ;i++){ // long t = tesscache->get(i); // switch(t){ // case TESSCACHE_NEWCONTOUR:break; // default: //printf("%i\n",t); //printf("%i\n",((GLdouble*)(t))[0]); //delete [] (GLdouble*)t;//i'm leaving this all in memory, but it's dangerous! //tessfreemem->push(t); //break; // } //} //delete tesscache; //tesscache = new Vector(); } else { //it WAS zero. //tesscache = new Vector(); } tessBase += tessPtr;//advance forward. tessPtr = 0; */ } void doTessErrorCheck(){ if(tessPtr+tessBase>tessmax){ printf("error:not enough memory allocated to JTTess",0); exit(0); } } void _tessBind(){ //#if defined (__DARWIN__) //#define TESSTYPE (GLvoid (*)(...)) //#else //typedef GLvoid ( *GluTessCallbackType)(...); //#define TESSTYPE reinterpret_cast //#endif /* gluTessCallback(tobj, GLU_TESS_VERTEX, TESSTYPE(glVertex3dv)); gluTessCallback(tobj, GLU_TESS_BEGIN, TESSTYPE(JTTess_beginCallback)); gluTessCallback(tobj, GLU_TESS_END, TESSTYPE(&JTTess_endCallback)); gluTessCallback(tobj, GLU_TESS_ERROR, TESSTYPE(JTTess_errorCallback)); gluTessCallback(tobj, GLU_TESS_COMBINE, TESSTYPE(JTTess_combineCallback)); gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE); */ } /* the callback routines registered by gluTessCallback() */ void JTTESSCALLBACK JTTess_combineCallback(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut ){ GLdouble *vertex; int i; doTessErrorCheck(); vertex = tesscache[tessBase+tessPtr];//(GLdouble *) malloc(6 * sizeof(GLdouble)); tessPtr++; vertex[0] = coords[0]; vertex[1] = coords[1]; vertex[2] = coords[2]; for (i = 3; i < 7; i++) vertex[i] = weight[0] * vertex_data[0][i] + weight[1] * vertex_data[1][i] + weight[2] * vertex_data[2][i] + weight[3] * vertex_data[3][i]; *dataOut = vertex; } void JTTESSCALLBACK JTTess_beginCallback(GLenum which){ glBegin(which); } void JTTESSCALLBACK JTTess_endCallback(void) { glEnd(); } void JTTESSCALLBACK JTTess_errorCallback(GLenum errorCode) { const GLubyte *estring; estring = gluErrorString(errorCode); fprintf (stderr, "Tessellation Error: %s\n", estring); exit (0); } /* new callback routines registered by these calls */ void JTTESSCALLBACK JTTess_vertexCallback(GLvoid *vertex){ const GLdouble *pointer; pointer = (GLdouble *) vertex; glColor3dv(pointer+3); glVertex3dv((const GLdouble*)vertex); } JoshFont *getFont(){ return font; } JPoint mouse(){ return JPoint(mouseX(),mouseY(),0); } /** saves the screen to a file. format support provided by image magick. supported formats: http://www.imagemagick.org/script/formats.php */ void saveScreen(char *filename){ using namespace Magick; if(rawpixels==NULL){ rawpixels = new unsigned char[width()*height()*3]; } glReadPixels(0,0,width(),height(), GL_RGB , GL_UNSIGNED_BYTE ,rawpixels); /* //reverse the alpha vals. for(int i=0;iflip(); return image; } /* allocates new storage for an 8-bit image of the specified dimensions */ png_bytep* make_pixels(int width, int height) { int pixel_size = 3; //printf("debug debug debug 1\n",0); png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { return NULL; } //printf("debug debug debug 2\n",0); png_bytep *row_pointers = (unsigned char **)png_malloc(png_ptr, height*sizeof(png_bytep)); for (int i = 0; i < height; i++) row_pointers[i] = (unsigned char *)png_malloc(png_ptr, width*pixel_size); //printf("debug debug debug 3\n",0); return row_pointers; } //-------------------------------------------------------------------------------------------- void jt_frameRate(unsigned long f){ frameRate = f; } void roundedRect(int gl_style,float x1,float y1,float x2,float y2,float radius,int steps){ float inc = (PI*0.5)/steps; glBegin(gl_style); //draw a quarter circle here. for(int i=0;i