public CompatibilityMesh(String filename, Shader shader, HashMap<String, Object> modelData)
	{
		if(shader.getAttributes().get("jointWeights") != null && modelData.get("skeleton") != null){
			skinned = true;
		}
		
		this.positionAttribute = shader.getAttributes().get("position");
		this.normalAttribute = shader.getAttributes().get("normal");
		this.texCoordAttribute = shader.getAttributes().get("texCoord");

		if(skinned){			
			this.jointWeightAttribute = shader.getAttributes().get("jointWeights");
			this.jointIndexAttribute = shader.getAttributes().get("jointIndices");
		}
		
		textureId = GLOperations.loadTexture("temp/debug.png");
		
		vao = glGenVertexArrays();
		positionVbo = glGenBuffers();
		normalVbo = glGenBuffers();
		texCoordVbo = glGenBuffers();

		if(skinned){
			jointWeightVbo = glGenBuffers();
			jointIndexVbo = glGenBuffers();
		}
		
		elements = glGenBuffers();
		
		glBindVertexArray(vao);
		
		
		FloatBuffer vertexBuff = GLOperations.generateFloatBuffer((float[])modelData.get("positions"));
		FloatBuffer normalBuff = GLOperations.generateFloatBuffer((float[])modelData.get("normals"));
		FloatBuffer texCoordBuff = GLOperations.generateFloatBuffer((float[])modelData.get("texCoords"));
		
		
		
		//get elements array
		float[] fElems = (float[])modelData.get("elements");
		int[] elems = new int[fElems.length];
		
		for(int i = 0; i < fElems.length; i++){
			elems[i] = (int)fElems[i];
		}
		
		this.elementCount = elems.length;
		IntBuffer elementBuff = GLOperations.generateIntBuffer(elems);
		
		
		//bind and buffer data
		glBindBuffer(GL_ARRAY_BUFFER, positionVbo);
        glBufferData(GL_ARRAY_BUFFER, vertexBuff , GL_STATIC_DRAW);
        
		glBindBuffer(GL_ARRAY_BUFFER, normalVbo);
        glBufferData(GL_ARRAY_BUFFER, normalBuff , GL_STATIC_DRAW);
        
        glBindBuffer(GL_ARRAY_BUFFER, texCoordVbo);
        glBufferData(GL_ARRAY_BUFFER, texCoordBuff, GL_STATIC_DRAW);
       
        
        IntBuffer jointIndexBuf = null;
      //TODO: This shouldn't happen when done, the other checks should guarantee it
        if(skinned){
        	FloatBuffer jointWeightBuf = GLOperations.generateFloatBuffer((float[])modelData.get("jointWeights"));
        	
        	jointIndexBuf = GLOperations.generateIntBuffer((int[])modelData.get("jointIndices"));
        	
        	glBindBuffer(GL_ARRAY_BUFFER, jointWeightVbo);
        	glBufferData(GL_ARRAY_BUFFER, jointWeightBuf, GL_STATIC_DRAW);
        	
        	
        	glBindBuffer(GL_ARRAY_BUFFER, jointIndexVbo);
        	glBufferData(GL_ARRAY_BUFFER, jointIndexBuf, GL_STATIC_DRAW);
        }
        
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elements);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementBuff, GL_STATIC_DRAW);
        
		
		
        //enable vertex attrib ptr
		glBindBuffer(GL_ARRAY_BUFFER, positionVbo);
		glEnableVertexAttribArray(positionAttribute);
		glVertexAttribPointer( positionAttribute, 3, GL_FLOAT, false, 0, 0);
        
		
        glBindBuffer(GL_ARRAY_BUFFER, normalVbo);
        glEnableVertexAttribArray(normalAttribute);
        glVertexAttribPointer( normalAttribute, 3, GL_FLOAT, false, 0, 0);
        
        glBindBuffer(GL_ARRAY_BUFFER, texCoordVbo);
        glEnableVertexAttribArray(texCoordAttribute);
        glVertexAttribPointer( texCoordAttribute, 2, GL_FLOAT, false, 0, 0);
        
        if(skinned){
        	glBindBuffer(GL_ARRAY_BUFFER, jointWeightVbo);
        	glEnableVertexAttribArray(jointWeightAttribute);
        	glVertexAttribPointer( jointWeightAttribute, 3, GL_FLOAT, false, 0, 0);


        	glBindBuffer(GL_ARRAY_BUFFER, jointIndexVbo);
        	glEnableVertexAttribArray(jointIndexAttribute);
//        	glVertexAttribIPointer( jointIndexAttribute, 3, GL_INT, 0, 0);
        	glVertexAttribPointer(jointIndexAttribute, 3, GL_FLOAT, false, 0, 0);

        }
        
        //glunbind buffer
	}