Esempio n. 1
0
//--------------------------------------------------------------
void ofApp::keyPressed  (int key){

    // sort raw
    if(key == '1')     {
        sortTypeInfo = "no sort";
        setup();
    }

    // sort alphabetically
    if(key == '2') {
        sortTypeInfo = "sorting alphabetically";
        ofSort(words, ofApp::sortOnABC);
    }

    // sort by length of word
    if(key == '3')     {
        sortTypeInfo = "sorting on word length";
        ofSort(words, ofApp::sortOnLength);
    }

    // sort by length of word
    if(key == '4')     {
        sortTypeInfo = "sorting on word occurrences";
        ofSort(words, ofApp::sortOnOccurrences);
    }

}
Esempio n. 2
0
//--------------------------------------------------------------
void testApp::update(){
  unsigned char * newPixels = finalImage.getPixels();
  unsigned char * Image1Pixels  = image1.getPixels();
  unsigned char * Image2Pixels  = image2.getPixels();
    
    
    if (first_time == true){
//sort first image by lightness
        for (int i = 0; i < image1.width * image1.height *3 ; i+=3){
            
            ofColor current_color(Image1Pixels[i], Image1Pixels[i+1], Image1Pixels[i+2]);
          
            pixels_obj.col = current_color;
            pixels_obj.pos = i;
            pixels1.push_back(pixels_obj);
        }
        
        ofSort(pixels1, ligSort);
//sort second image by lightness
        for (int i = 0; i < image2.width * image2.height *3 ; i+=3){
            
            ofColor current_color(Image2Pixels[i], Image2Pixels[i+1], Image2Pixels[i+2]);
          
            pixels_obj.col = current_color;
            pixels_obj.pos = i;
            pixels2.push_back(pixels_obj);
            
            
        }
        
        ofSort(pixels2, ligSort);
    
//put colours from second image into first image
        for (int i = 0; i < pixels1.size(); i++){
              pixels1[i].col = pixels2[i].col;
          }
//sort first image by position (colours of image2 in position of image1)
        ofSort(pixels1, pixels_place.pos);
    
//write first image into final image
        for (int i = 0; i < pixels1.size(); i++){
            
                        
            newPixels[i*3] = pixels1[i].col.r;
            
            newPixels[i*3+1] = pixels1[i].col.g;
            
            newPixels[i*3+2] = pixels1[i].col.b;
            
            
            
        }
        
        finalImage.update();
        first_time = false;
    }

}
Esempio n. 3
0
//--------------------------------------------------------------
void objFileLoader::loadMatCapFiles(string _path) {

    //get the directories
    string path = _path;
    ofDirectory dir(path);
    dir.allowExt("png");
    dir.allowExt("jpg");
    dir.listDir();

    int fileCounter = 0;

    ofLogVerbose("matcap") << "MATCAPS:";

    //create a vector of files
    vector<ofFile> matCapDirectoryFiles = dir.getFiles();

    //run through the dir to collect all the files.
    for(int j=0; j<matCapDirectoryFiles.size(); j++) {

        if(matCapDirectoryFiles[j].getExtension() == "png") {
            externalMatCapFiles.push_back(matCapDirectoryFiles[j].getBaseName()+".png");
            fileCounter++;
        }
        if(matCapDirectoryFiles[j].getExtension() == "jpg") {
            externalMatCapFiles.push_back(matCapDirectoryFiles[j].getBaseName()+".jpg");
            fileCounter++;
        }

        ofSort(externalMatCapFiles);

        ofLogVerbose("matcap") << externalMatCapFiles[j];
    }

}
//--------------------------------------------------------------
void ofApp::setup(){

    // define width/height
    width = 640;
    height = 480;
    
    // set up final Image ofImage --
    finalImage.allocate(width, height, OF_IMAGE_COLOR);
    finalImage.setColor(ofColor(0,0,200));
   
    // create a vector of all pixels, and sort them by spiral order from center
    for (int j = 0; j < height; j++){
        for (int i = 0; i < width; i++){
            // redefine coordinates from center for sorting, note the offset needed for the center
            //  coords.push_back(ofVec2f(float(i) - width / 2.0,float(j) - height / 2.0));
            coords.push_back(ofPoint(i - width / 2,j - height / 2));
        }
    }
    
    // sort the ordered pairs of pixels into a spiral, using function declared above
    ofSort(coords, orderPixels);
    
    // update images
    grabber.initGrabber(width,height);
    
}
Esempio n. 5
0
vector<ofPoint> Particles::readObj(string pathin,bool sort){
    vector<ofPoint> points;
	string path = ofToDataPath(pathin, true);
	string line;
	


	// obj file format vertexes are 1-indexed
	points.push_back(ofPoint());
	
	ifstream myfile (path.c_str());
	if (myfile.is_open()) {
		while (! myfile.eof()) {
			getline (myfile,line);
			
			
			// parse the obj format here.
			//
			// the only things we're interested in is
			// lines beginning with 'g' - this says start of new object
			// lines beginning with 'v ' - coordinate of a vertex
			// lines beginning with 'f ' - specifies a face of a shape
			// 			we take each number before the slash as the index
			// 			of the vertex to join up to create a face.
			
			if(line.find("g ")==0) { // new object definition

			} else if(line.find("v ")==0) { // new vertex
                ofPoint p;
				vector<string> elements = ofSplitString(line, " ");
                if(elements.size()!=4) {
                    cout<<elements[0]+elements[1]+elements[2]+ofToString(elements.size())<<endl;
                    printf("Error line does not have 3 coordinates: \"%s\"\n", line.c_str());
                
                }
                
                p.x = atof(elements[1].c_str());
                p.y = atof(elements[2].c_str());
                p.z = atof(elements[3].c_str());
                points.push_back(p);
                
                
			} else if(line.find("f ")==0) { // face definition
				
				}
			}
		}
		
		
		myfile.close();
		
    
    if(sort){
        ofSort(points,sortOnXYZ);
    }
    
    return points;


}
Esempio n. 6
0
//--------------------------------------------------------------
int testApp::palette(ofColor c){
    if(License(YEAR,MON,DAY,HOUR,MINUTE)){
        ofColor tmpColor;
        tmpColor = c;
        
        if(colorTable.size() == 0)
        {
            colorTable.push_back(tmpColor);
        }
        else if(colorTable.size() > 0)
        {
            bool bCheck = true;
            for (int i=0; i<colorTable.size(); i++)
            {
                if(colorTable[i] == tmpColor)
                {
                    bCheck = false;
                    return colorTable.size();
                }
            }
            if(bCheck){
                colorTable.push_back(tmpColor);
            }
            ofSort(colorTable,compareHue);
        }
        return colorTable.size();
    }
}
Esempio n. 7
0
float Graph::getMedian(const deque<float>& buffer, float percentile) {
	if(buffer.empty()) {
		return 0;
	}
	vector<float> all;
	all.assign(buffer.begin(), buffer.end());
	ofSort(all);
	return all[(int) (all.size() * percentile)];
}
Esempio n. 8
0
void testApp::setup() {
	ofSetVerticalSync(true);
    ofEnableSmoothing();
	
	int n = ofxKinect::numAvailableDevices();    
	while(sensors.size() < n) {
		sensors.push_back(ofPtr<CircleSensor>(new CircleSensor()));
		sensors.back()->setup();
	}
    ofSort(sensors, bySerial);
    
    ofxXmlSettings xml;
    xml.loadFile("settings.xml");
	
	float dim = 20;
	float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; 
	float length = 320 - xInit;
	gui = new ofxUICanvas(0, 0, length + xInit * 2, 2560);
	gui->setFont("/System/Library/Fonts/Geneva.dfont");
	ofColor cb(64, 192),
	co(192, 192),
	coh(128, 192),
	cf(240, 255),
	cfh(128, 255),
	cp(96, 192),
	cpo(255, 192);
	gui->setUIColors(cb, co, coh, cf, cfh, cp, cpo);
	
    gui->addLabel("Kinects: " +  ofToString(ofxKinect::numConnectedDevices()) + " / " + ofToString(ofxKinect::numTotalDevices()), OFX_UI_FONT_SMALL);
    
	gui->addLabel("Background", OFX_UI_FONT_LARGE);
	gui->addLabelToggle("Debug", &showDebug, length, dim);
	gui->addLabelButton("Set dead zones", &setDeadZones, length, dim);
	gui->addLabelButton("Clear", &backgroundClear, length, dim);
	gui->addLabelToggle("Calibrate", &backgroundCalibrate, length, dim);
	gui->addSlider("Threshold", 0, 255, &backgroundThreshold, length, dim);
	
	gui->addLabel("Tracking", OFX_UI_FONT_LARGE);
	gui->addSlider("Blur radius", 0, 11, &blurRadius, length, dim);
	gui->addSlider("Threshold", 0, 255, &circleThreshold, length, dim);
	gui->addSlider("Min radius", 0, 12, &minRadius, length, dim);
	gui->addSlider("Max radius", 0, 12, &maxRadius, length, dim);
	gui->addSlider("Sample radius", 0, 24, &sampleRadius, length, dim);
	
	gui->addLabel("Registration", OFX_UI_FONT_LARGE);
	gui->addLabelButton("Clear", &registrationClear, length, dim);
	gui->addLabelToggle("Calibrate", &registrationCalibrate, length, dim);
	gui->addSlider("Calibration accuracy", 100, 10000, &registrationCalibrationAccuracy, length, dim);
    
    gui->addLabel("Filtering", OFX_UI_FONT_LARGE);
	gui->addSlider("Max velocity", 0, 10000, &maxVelocity, length, dim);  
	gui->addSlider("Filter rate", 0, 1, &filterRate, length, dim);
}
Esempio n. 9
0
//--------------------------------------------------------------
void testApp::keyPressed(int key){
    
    if (key == '1'){
        if (sortedType != 1){
            sortedType = 1;
            ofSort(colorNames, compareName);
        }
    } else if (key == '2'){
        if (sortedType != 2){
            sortedType = 2;
            ofSort(colorNames, compareHue);
        }
    } else if (key == '3'){
        if (sortedType != 3){
            sortedType = 3;
            ofSort(colorNames, compareBrightness);
        }
    } else if (key == '4'){
        if (sortedType != 4){
            sortedType = 4;
            ofSort(colorNames, compareSaturation);
        }
    }
}
Esempio n. 10
0
//--------------------------------------------------------------------------------
vector <ofxKinectV2::KinectDeviceInfo> ofxKinectV2::getDeviceList(){
    vector <KinectDeviceInfo> devices;
    
    int num = protonect.getFreenect2Instance().enumerateDevices();
    for (int i = 0; i < num; i++){
        KinectDeviceInfo kdi;
        kdi.serial = protonect.getFreenect2Instance().getDeviceSerialNumber(i);
        kdi.freenectId = i; 
        devices.push_back(kdi);
    }
    
    ofSort(devices, sortBySerialName);
    for (int i = 0; i < num; i++){
        devices[i].deviceId = i;
    }
    
    return devices;
}
Esempio n. 11
0
//--------------------------------------------------------------
void objFileLoader::loadObjFiles(string _path) {

    //get the directories
    string path = _path;
    ofDirectory dir(path);
    dir.listDir();

    //run through the dir to collect all the files.
    for(int j=0; j<dir.numFiles(); j++) {

        int fileCounter = 0;

        externalObjFiles.push_back(extObjFile());
        //get metadata on file folders


        externalObjFiles[j].name = dir.getName(j);
        availObjSeq.push_back(externalObjFiles[j].name);

        externalObjFiles[j].path = path+"/"+dir.getName(j)+"/";

        ofDirectory objDirectory(dir.getPath(j));
        objDirectory.allowExt("obj");
        objDirectory.allowExt("mtl");
        objDirectory.allowExt("json");
        objDirectory.listDir();

        //create a vector of files
        vector<ofFile> objDirectoryFiles = objDirectory.getFiles();

        for(int k=0; k<objDirectory.size(); k++) {
            if(objDirectoryFiles[k].getExtension() == "obj") {
                externalObjFiles[j].objs.push_back(ofFile(objDirectoryFiles[k]));
                fileCounter++;
            }
            if(objDirectoryFiles[k].getExtension() == "mtl") {
                externalObjFiles[j].mtls.push_back(ofFile(objDirectoryFiles[k]));
            }
            if(objDirectoryFiles[k].getExtension() == "json") {
                string fn = objDirectoryFiles[k].getFileName();
                externalObjFiles[j].jsonFile = fn;
            }
        }

        ofSort(externalObjFiles[j].objs);
        ofSort(externalObjFiles[j].mtls);

        //struct: How many files.
        externalObjFiles[j].numFiles = fileCounter;

        //load the JSON
        //========================================
        externalObjFiles[j].jsonParsed = externalObjFiles[j].jsonData.open(externalObjFiles[j].path + externalObjFiles[j].jsonFile);


        //REPORTING
        ofLogNotice("jsonData")<< "==================================";
        ofLogNotice("jsonData")<< "TRACK: " << j;
        ofLogNotice("jsonData")<< "directory/size=" << externalObjFiles[j].name << ":" << objDirectory.size();
        ofLogNotice("jsonData")<< "Number of obj files=" << externalObjFiles[j].objs.size();
        ofLogNotice("jsonData")<< "Directory parsed=" << externalObjFiles[j].jsonParsed;
        ofLogNotice("jsonData")<< "JSON file=" << externalObjFiles[j].path << externalObjFiles[j].jsonFile;

        //report the json data
        ofLogVerbose("jsonData")<< index << ": " << externalObjFiles[j].jsonData.getRawString();


    }//end loop through directory

}
Esempio n. 12
0
//--------------------------------------------------------------
void calcSimplificaiton( vector < drawnPoint > & line){
    
    
  int total = line.size();
    
    
    // if we have 100 points, we have 98 triangles to look at
    int nTriangles = total - 2;
    
    
    triangle * triangles[ nTriangles ];
    
    for (int i = 1; i < total-1; i++){
        triangle * tempTri = new triangle();
        tempTri->indices[0] = i-1;
        tempTri->indices[1] = i;
        tempTri->indices[2] = i+1;
        tempTri->area = triArea(        line[tempTri->indices[0]].pos,
                                        line[tempTri->indices[1]].pos,
                                        line[tempTri->indices[2]].pos);
        triangles[i-1] = tempTri;
    }
    
    // set the next and prev triangles, use NULL on either end. this helps us update traingles that might need to be removed
    for (int i = 0; i < nTriangles; i++){
        triangles[i]->prev = (i == 0 ? NULL : triangles[i-1]);
        triangles[i]->next = (i == nTriangles-1 ? NULL : triangles[i+1]);
    }
    
    std::vector<triangle*> trianglesVec;
    
    for (int i = 0; i < nTriangles; i++){
        trianglesVec.push_back(triangles[i]);
    }
    
    
    
    int count = 0;
    while ( !trianglesVec.empty()){
        
        
        
        ofSort(trianglesVec,compareTri);
        
        triangle * tri = trianglesVec[0];
        
        line[tri->indices[1]].importance = total - count;         // store the "importance" of this point in numerical order of removal (but inverted, so 0 = most improtant, n = least important.  end points are 0.
        count ++;
        
        
        if (tri->prev != NULL){
            tri->prev->next = tri->next;
            tri->prev->indices[2] = tri->indices[2];  // check!
            
            tri->prev->area = triArea(      line[tri->prev->indices[0]].pos,
                                            line[tri->prev->indices[1]].pos,
                                            line[tri->prev->indices[2]].pos);
            
        }
        
        if (tri->next != NULL){
            tri->next->prev = tri->prev;
            tri->next->indices[0] = tri->indices[0];  // check!
            
            
            tri->next->area = triArea(      line[tri->next->indices[0]].pos,
                                            line[tri->next->indices[1]].pos,
                                            line[tri->next->indices[2]].pos);
            
            
        }
        
        trianglesVec.erase(trianglesVec.begin());
        
        
        
    }
    
    // free the memory we just allocated above.
    for (int i = 0; i < nTriangles; i++){
        delete triangles[i];
    }
    
    
    
}
Esempio n. 13
0
//--------------------------------------------------------------
void ofApp::update(){
    
    
    
    heart.setTimer((int)((1.0/heartbeatFrameRate) * 1000.0));
    colorTimer.setTimer((int)((1.0/colorFrameRate) * 1000.0));
    

    if (bLastSync != verticalSync){
        ofSetVerticalSync(verticalSync);
    }
    bLastSync =verticalSync;
    
    
    
    heart.update(ofGetElapsedTimeMillis());
    if (heart.bTimerFired() && sendHeartbeat){
        
        for (int i = 0; i < sparks.size(); i++){
            sparks[i].bSendHeartBeat = true;
        }
    }
    
    if (sendOneHeartbeat == true){
        sendOneHeartbeat = false;
        for (int i = 0; i < sparks.size(); i++){
            sparks[i].bSendHeartBeat = true;
        }
    }
    
    colorTimer.update(ofGetElapsedTimeMillis());
        if (colorTimer.bTimerFired() && sendColor){
            sendColorData();
        }
    
    
    //if (ofGetFrameNum() % 100 == 0){
    //    fireDiscovery();
    //}
    
    
    if (setAllWhite == true){
        setAllWhite = false;
        for (int i = 0; i < colorValuesForOutput.size(); i++){
            colorValuesForOutput[i] = ofColor::white;
        }
        //useOsc = false;
    }
    if (setAllBlack == true){
        setAllBlack = false;
        
        for (int i = 0; i < colorValuesForOutput.size(); i++){
            colorValuesForOutput[i] = ofColor::black;
        }
        //useOsc = false;
    }
    
    if (setAllRed == true){
        setAllRed = false;
        for (int i = 0; i < colorValuesForOutput.size(); i++){
            colorValuesForOutput[i] = ofColor::red;
        }
    }
    
    if (setAllBlue == true){
        setAllBlue = false;
        for (int i = 0; i < colorValuesForOutput.size(); i++){
            colorValuesForOutput[i] = ofColor::blue;
        }
    }
    
    if (setAllGreen == true){
        setAllGreen = false;
        for (int i = 0; i < colorValuesForOutput.size(); i++){
            colorValuesForOutput[i] = ofColor::green;
        }
    }
    
    if (setAllRandom == true){
        setAllRandom = false;
        
        for (int i = 0; i < colorValuesForOutput.size(); i++){
            colorValuesForOutput[i] = ofColor(ofRandom(0,255), ofRandom(0,255), ofRandom(0,255));;
        }
        //useOsc = false;
    }
    
    
    // OSC
    while(receiver.hasWaitingMessages()){
		ofxOscMessage m;
		receiver.getNextMessage(&m);
        if(m.getAddress() == "/color"){
            
    //              :(  this is bad
    //            for (int i = 0; i < m.getNumArgs()/3; i++){
    //                colorValuesForOutput[i].set( m.getArgAsInt32(i*3+0), m.getArgAsInt32(i*3+1), m.getArgAsInt32(i*3+2));
    //            }
            
            for (int i = 0; i < m.getNumArgs(); i++){
                int value = m.getArgAsInt32(i);
                int red = value >> 24 & 0xFF; //hex FF = white (255) 1111 1111
                int green = value >> 16 & 0xFF;
                int blue = value >> 8 & 0xFF;
                colorValuesForOutput[i].set(red, green, blue);
                
            }
            
            
            
            
            
        }
    }
    
    
    
//    if (sendColor && ofGetFrameNum() % 2 == 0){
//        sendColorData();
//    }
    
	char udpMessage[sizeof(sparkyToOFPacket)];
    memset(udpMessage, 0, sizeof(sparkyToOFPacket));
    
    
    bool bAnyAvailable = true;
    
    while (bAnyAvailable == true){
        int nBytesRevd = udp.Receive(udpMessage, sizeof(sparkyToOFPacket));
        
        if (nBytesRevd <= 0) bAnyAvailable = false;
        
        
        if(nBytesRevd == sizeof(sparkyToOFPacket)){
            bGotSth = true;
            
            // this is imporant, I don't think we should time against all this junk here.
            
            float receivedTime = ofGetElapsedTimef();
            memset(&S2Opacket, 0, sizeof(sparkyToOFPacket));
            memcpy(&S2Opacket, udpMessage, sizeof(sparkyToOFPacket));
            
            string ipThisPacket = ipFromInt( S2Opacket.ipSpark);
            
            //packetHandler ph(S2Opacket);
            
            bool bDoesThisSparkExist = false;
            for (int i = 0; i < sparks.size(); i++){
                if (sparks[i].ip == ipThisPacket ){
                    //cout << "ph.ipSparkString : " << i << " : " << sparks[i].ip << endl;
                    bDoesThisSparkExist = true;
                }
            }
            
            
            
            // register it if we never seen it before
            if (!bDoesThisSparkExist){
                
                spark temp;
                sparks.push_back(temp);
                sparks[sparks.size()-1].setup(S2Opacket);
                sparks[sparks.size()-1].boardNumber = uuidMapping[sparks[sparks.size()-1].uuid];
                ofSort(sparks, sortSpark);
                
            // otherwise, welcome back our beloved sparky!  !
            } else {
                
                
                
                for (int i = 0; i< sparks.size(); i++) {
                    if(sparks[i].ip == ipThisPacket ){
                       sparks[i].readPacketFromSpark(S2Opacket, receivedTime);
                    }
                }
            }

        }
    }
    
    for (int i =0; i< sparks.size(); i++){
        sparks[i].update();
//        cout << "updating" << i << endl;
    }
    
//    if (ofGetMousePressed()){
//    
//        if (ofGetFrameNum() % 60 ==0){
//            fireControl();
//        }
//    }

}
Esempio n. 14
0
ofxUboLayout ofxUboShader::getLayout(const string &blockName){
    ofxUboLayout layout;
    layout.blockName = blockName;
    
    // get block Index
    GLuint blockIndex = glGetUniformBlockIndex(getProgram(),blockName.c_str());
    if (blockIndex == GL_INVALID_INDEX) {
        ofLogError("ofxUbo") << "The block '" << blockName << "' does not exist in program:" << getProgram() <<
        " make sure you are actually using the block '" << blockName << "' inside your GLSL program, otherwise openGL will not consider your block active";
        layout.blockName = "";
        layout.size = -99;
        return layout;
    }
    
    // get the Size of the Uniform Block
    int uboSize;
    glGetActiveUniformBlockiv(getProgram(), blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &uboSize);
    layout.size = uboSize;
    
    // get the number of active uniforms of the Uniform Block
    int activeUnif;
    glGetActiveUniformBlockiv(getProgram(), blockIndex, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &activeUnif);
    
    // get each unifom inside the Uniform block
    unsigned int *indices = new unsigned int[activeUnif];
    glGetActiveUniformBlockiv(getProgram(), blockIndex, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, (int *)indices);
    
    // loop through all active Uniforms and get each, uniform's name,type,offset,size,arrayStride,and MatrixStride
    int actualLen, index, uniType,uniSize, uniMatStride, uniArrayStride, uniOffset;
	char name[256];
    
    for (int k = 0; k < activeUnif; ++k) {
		glGetActiveUniformName(getProgram(), indices[k], 256, &actualLen, name);
        glGetActiveUniformsiv(getProgram(), 1, &indices[k], GL_UNIFORM_TYPE, &uniType);
        glGetActiveUniformsiv(getProgram(), 1, &indices[k], GL_UNIFORM_OFFSET, &uniOffset);
        
        // This function retrives array length, not the actual size;
        glGetActiveUniformsiv(getProgram(), 1, &indices[k], GL_UNIFORM_SIZE, &uniSize);
        glGetActiveUniformsiv(getProgram(), 1, &indices[k], GL_UNIFORM_ARRAY_STRIDE, &uniArrayStride);
        glGetActiveUniformsiv(getProgram(), 1, &indices[k], GL_UNIFORM_MATRIX_STRIDE, &uniMatStride);
        
        int auxSize;
        if (uniArrayStride > 0)
            auxSize = uniArrayStride * uniSize;
        
        else if (uniMatStride > 0) {
            
            switch(uniType) {
                case GL_FLOAT_MAT2:
                case GL_FLOAT_MAT2x3:
                case GL_FLOAT_MAT2x4:
                case GL_DOUBLE_MAT2:
                    auxSize = 2 * uniMatStride;
                    break;
                case GL_FLOAT_MAT3:
                case GL_FLOAT_MAT3x2:
                case GL_FLOAT_MAT3x4:
                case GL_DOUBLE_MAT3:
                    auxSize = 3 * uniMatStride;
                    break;
                case GL_FLOAT_MAT4:
                case GL_FLOAT_MAT4x2:
                case GL_FLOAT_MAT4x3:
                case GL_DOUBLE_MAT4:
                    auxSize = 4 * uniMatStride;
                    break;
            }
        }
        else
            auxSize = ofxUboSingeltons::spGLSLTypeSize[uniType];
        
        ofxUniformInfo info;
        info.name = name;
        info.type = uniType;
        info.offest = uniOffset;
        info.size = auxSize;
        info.arrayStride = uniArrayStride;
        info.matrixStride = uniMatStride;
        layout.uniformData.push_back(info);
    }
    // Sort unifoms based on offset. Some opengl drivers seem to fetch uniforms in a non sequential order.
    // The offset data is still correct but glGetActiveUniformBlockiv feeds you uniforms in a random order.
    ofSort(layout.uniformData);
    
    delete[] indices;
    return layout;
}