Compatibility problem from version 2.1 to 3.3


#1

Hey guys ! I’m kinda new to openFrameworks and I’m trying to play around ! I stumbled on this addon : https://github.com/kashimAstro/ofxShaderSelect . It’s working perfectly with an openGL version of 2.1 but when I modify the GLVersion to 3.3 nothing appears !

Here’s the draw function :
void ofApp::draw()
{
ofBackgroundGradient(ofColor(200), ofColor(0, 0, 65));

	cam.begin();
	ofEnableDepthTest();
	pass.begin();

	ofMatrix4x4 camdist;

	camdist.preMultTranslate(ofVec3f(0, 0, 600));
	if (!stopRotate)
		camdist.preMultRotate(ofQuaternion(ofGetElapsedTimeMillis()*0.065, ofVec3f(0, 0, 1)));

	
	pass.setUniformMatrix4f("Modelview", cam.getModelViewMatrix()*(glm::mat4)camdist);
	pass.setUniformMatrix4f("Projection", cam.getProjectionMatrix());
	pass.setUniformMatrix3f("NormalMatrix", shader.mat4ToMat3(ofGetCurrentNormalMatrix()));
	pass.setUniform1f("TessLevelInner", levelInner);
	pass.setUniform1f("TessLevelOuter", levelOuter);
	pass.setUniform3f("LightPosition", lightpos->x, lightpos->y, lightpos->z);
	pass.setUniform3f("DiffuseMaterial", diffMat->x, diffMat->y, diffMat->z);
	pass.setUniform3f("AmbientMaterial", ambMat->x, ambMat->y, ambMat->z);



	vbo.drawElements(GL_PATCHES, vbo.getNumVertices()*vbo.getNumVertices());



	pass.end();
	ofDisableDepthTest();
	cam.end();

	gui.draw();
}

Is it possible that vbo.drawElements doesn’t work with a version of openGL 3.1 and higher ?

Anyway, thank you for your time !


#2

shader syntax is slightly different from opengl 2.1 to 3+ so surely the shaders included in the addon are not compatible with opengl3. the changes needed to adapt a shader from one version to the other are not so much so it’s probably relatively straightforward to fix them