Ejemplo n.º 1
0
//--------------------------------------------------------------
void ofVbo::setAttributeData(int location, const float * attrib0x, int numCoords, int total, int usage, int stride){
	if(location==ofShader::POSITION_ATTRIBUTE){
		#if defined(TARGET_ANDROID) || defined(TARGET_OF_IOS)
			registerVbo(this);
		#endif
		if(ofIsGLProgrammableRenderer()){
			totalVerts = total;
			#ifdef TARGET_OPENGLES
				glGenVertexArrays = (glGenVertexArraysType)dlsym(RTLD_DEFAULT, "glGenVertexArrays");
				glDeleteVertexArrays =  (glDeleteVertexArraysType)dlsym(RTLD_DEFAULT, "glDeleteVertexArrays");
				glBindVertexArray =  (glBindVertexArrayType)dlsym(RTLD_DEFAULT, "glBindVertexArrayArrays");
			#endif
		}
	}

	bool normalize = false;
	if(!hasAttribute(location)){
		vaoChanged = true;
		if (ofIsGLProgrammableRenderer()) {
			bUsingVerts |= (location == ofShader::POSITION_ATTRIBUTE);
			bUsingColors |= (location == ofShader::COLOR_ATTRIBUTE);
			bUsingNormals |= (location == ofShader::NORMAL_ATTRIBUTE);
			bUsingTexCoords |= (location == ofShader::TEXCOORD_ATTRIBUTE);
		}
	}

	getOrCreateAttr(location).setData(attrib0x,numCoords,total,usage,stride,normalize);
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void ofVbo::setAttributeBuffer(int location, ofBufferObject & buffer, int numCoords, int stride, int offset){
	if(ofIsGLProgrammableRenderer() && !hasAttribute(location)){
		vaoChanged = true;
		bUsingVerts |= (location == ofShader::POSITION_ATTRIBUTE);
		bUsingColors |= (location == ofShader::COLOR_ATTRIBUTE);
		bUsingNormals |= (location == ofShader::NORMAL_ATTRIBUTE);
		bUsingTexCoords |= (location == ofShader::TEXCOORD_ATTRIBUTE);
	}

	getOrCreateAttr(location).setBuffer(buffer, numCoords, stride, offset);
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void ofVbo::setAttributeData(int location, const float * attrib0x, int numCoords, int total, int usage, int stride){
	if(ofIsGLProgrammableRenderer() && location==ofShader::POSITION_ATTRIBUTE){
		totalVerts = total;
	}

	bool normalize = false;
	if(ofIsGLProgrammableRenderer() && !hasAttribute(location)){
		vaoChanged = true;
		bUsingVerts |= (location == ofShader::POSITION_ATTRIBUTE);
		bUsingColors |= (location == ofShader::COLOR_ATTRIBUTE);
		bUsingNormals |= (location == ofShader::NORMAL_ATTRIBUTE);
		bUsingTexCoords |= (location == ofShader::TEXCOORD_ATTRIBUTE);
		normalize = (location == ofShader::NORMAL_ATTRIBUTE);
	}

	getOrCreateAttr(location).setData(attrib0x,numCoords,total,usage,stride,normalize);
}
Ejemplo n.º 4
0
//--------------------------------------------------------------
void ofVbo::setAttributeDivisor(int location, int divisor){
	getOrCreateAttr(location).divisor = divisor;
}