Skip to content

ofMesh::icosahedron doesn't draw correctly #5512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cuinjune opened this issue Mar 29, 2017 · 7 comments
Open

ofMesh::icosahedron doesn't draw correctly #5512

cuinjune opened this issue Mar 29, 2017 · 7 comments

Comments

@cuinjune
Copy link
Contributor

cuinjune commented Mar 29, 2017

Every other 3d mesh objects work well but icosahedron doesn't draw correctly.
I think it has to do with incorrect normals.

4f773e6de10807eb27aa2664f2c4a8a01f2bff44

Here's a link to the forum post
https://forum.openframeworks.cc/t/ofmesh-icosahedron-doesnt-draw-correctly/26301

And Here's my test code

in ofApp.h

#pragma once

#include "ofMain.h"

class ofApp : public ofBaseApp{
public:
    void setup();
    void update();
    void draw();

    ofLight light;
    ofMaterial material;
    ofMesh sphere;
    ofMesh icosphere;
    ofMesh icosahedron;
    float degree;
		
};

in ofApp.cpp

#include "ofApp.h"

void ofApp::setup(){

    ofSetBackgroundColor(10, 10, 10);
    ofEnableDepthTest();

    //directional light
    light.setDirectional();
    light.setSpecularColor(ofColor(255));
    light.setDiffuseColor(ofColor(255));
    light.setAmbientColor(ofColor(100));
    light.setOrientation(ofVec3f(0,180,0));

    //material
    material.setShininess(120);
    material.setSpecularColor(ofColor(0));
    material.setDiffuseColor(ofColor(200));
    material.setAmbientColor(ofColor(0));

    //mesh
    sphere = ofMesh::sphere(100);
    icosphere = ofMesh::icosphere(100);
    icosahedron = ofMesh::icosahedron(100);
}

void ofApp::update(){
    degree++;
}

void ofApp::draw(){
    ofEnableLighting();
    light.enable();
    material.begin();

    //draw sphere
    ofPushMatrix();
    ofTranslate(ofGetWidth()*0.2, ofGetHeight()*0.5);
    ofDrawBitmapString("SPHERE", -35, -130);
    ofRotateDeg(degree, 1, 1, 1);
    sphere.draw();
    ofPopMatrix();

    //draw icosphere
    ofPushMatrix();
    ofTranslate(ofGetWidth()*0.5, ofGetHeight()*0.5);
    ofDrawBitmapString("ICOSPHERE", -40, -130);
    ofRotateDeg(degree, 1, 1, 1);
    icosphere.draw();
    ofPopMatrix();

    //draw icosahedron
    ofPushMatrix();
    ofTranslate(ofGetWidth()*0.8, ofGetHeight()*0.5);
    ofDrawBitmapString("ICOSAHEDRON", -40, -130);
    ofRotateDeg(degree, 1, 1, 1);
    icosahedron.draw();
    ofPopMatrix();
    
    material.end();
    light.disable();
    ofDisableLighting();
}
@bakercp
Copy link
Member

bakercp commented May 22, 2017

Confirmed on master w/ macOS.

@bakercp bakercp added this to the 0.10.0 milestone May 22, 2017
@hamoid
Copy link
Contributor

hamoid commented May 23, 2017

I volunteer to do this next week :)

@tgfrerer
Copy link
Member

It's perhaps worth checking whether this issue is connected to #4626, and #2676

@hamoid
Copy link
Contributor

hamoid commented May 23, 2017

I see, I thought only normals were missing. I volunteer to add the missing normals and texture coords :)

@bakercp
Copy link
Member

bakercp commented May 23, 2017

Offer accepted @hamoid! Thanks for looking into it.

@hamoid
Copy link
Contributor

hamoid commented Jun 5, 2017

#5650
2017-06-05-204001_1024x768_scrot

@cuinjune
Copy link
Contributor Author

cuinjune commented Jun 6, 2017

Nice work @hamoid I appreciate it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants