@Massimiliano_Zanoni wrote:
Dear all,
I’m a quite a beginner in using OpenFrameworks. I’m trying to write a simple piece of software able to load a Collada file. The file includes the 3d model, lights, texture, material, shader info and so on. In particular the model is related to a transparent 3d water drop.
I use ofxAssimpModelLoader to load the .dae file, but the results I get is not a transparent 3d water drop, but a solid blue 3d drop.
Here is the code:
void ofApp::setup(){
ofSetVerticalSync(true);
model.loadModel(“O3_Cina_Drop_03.dae”, true);
autoRotate = 0;
mesh = model.getMesh(0);
texture = model.getTextureForMesh(0);
material = model.getMaterialForMesh(0);
}//--------------------------------------------------------------
void ofApp::update(){float stepRotate = 0.05; autoRotate = autoRotate + stepRotate; if (autoRotate >= 360) autoRotate = 0; distance = float(ofGetMouseY())/float(ofGetHeight()); interactRotate = ofGetMouseX();
}
//--------------------------------------------------------------
void ofApp::draw(){
ofBackground(255, 255, 255);ofEnableDepthTest(); ofEnableLighting(); //model.setPosition(ofGetWidth()/2, (float)ofGetHeight()/2 , 0); ofTranslate(ofGetWidth()/2, (float)ofGetHeight()/2, 0); ofScale(distance); ofRotateYDeg(autoRotate); ofRotateYDeg(interactRotate); light.enable(); texture.bind(); material.begin(); model.drawFaces(); material.end(); texture.unbind(); light.disable(); ofDisableDepthTest(); ofDisableLighting();
}
Here you can find the xcode project:
Any help is welcomed.
Thank you
Posts: 3
Participants: 2