Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "OpenGLFramework.h"
- #include "LorenzAttractor.h"
- #ifndef __MY_FRAMEWORK__
- #define __MY_FRAMEWORK__
- using namespace openGLFramework;
- class MyFramework : public virtual OpenGLFramework {
- private:
- LorenzAttractor *lorenzAttractor;
- unsigned int numLorenzAttractors;
- public:
- MyFramework() {
- lorenzAttractor = NULL;
- }
- ~MyFramework() {
- delete lorenzAttractor;
- }
- void setNumberOfLorenzAttractors(unsigned int number) {
- numLorenzAttractors = number;
- }
- void initLorenzAttractor(unsigned int i, float sx, float sy, float sz, float r, float g, float b) {
- if(lorenzAttractor == NULL) {
- lorenzAttractor = new LorenzAttractor[numLorenzAttractors];
- }
- if(lorenzAttractor == NULL) {
- cout << "Lorenz Attractor construction failed" << endl;
- }
- if(i >= numLorenzAttractors || i < 0) {
- cout << "Array Out of bounds. Check value of 'i'." << endl;
- }
- lorenzAttractor[i].setAttributes(sx, sy, sz, r, g, b);
- }
- void draw() {
- if( 1 == getNumberOfSubWindows() ) {
- setWindowContext(0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- invokeGlutLookAt();
- draw3DCoordinateAxis();
- for(unsigned int i = 0; i < numLorenzAttractors; i++) {
- lorenzAttractor[i].simulate();
- }
- glutSwapBuffers();
- } else if( getNumberOfSubWindows() == numLorenzAttractors ) {
- for(unsigned int i = 0; i < numLorenzAttractors; i++) {
- setWindowContext(i);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- invokeGlutLookAt();
- draw3DCoordinateAxis();
- lorenzAttractor[i].simulate();
- glutSwapBuffers();
- }
- }
- }
- };
- #endif //__MY_FRAMEWORK__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement