Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

Broken of3dPrimitive mesh append

$
0
0

@Hennio wrote:

Hi,

Messing around with of3dPrimitive and ofMeshes I encountered a strange bug.

It seems that you cannot freely append to a current of3dPrimitive any type of ofMesh, some images to explain..

Appending a box to an of3dPrimitive:

primitive.getMesh().append(ofMesh::box(10,10,10));

Appending a sphere to an of3dPrimitive:

primitive.getMesh().append(ofMesh::sphere(10));

Appending a cone to an of3dPrimitive:

 primitive.getMesh().append(ofMesh::cone(10,10));

There seems to be an issue with the winding of the faces when appending meshes.

Here you have a small test app to try it out:


#pragma once

#include "ofMain.h"
#include "EasyCam.h"

class testApp : public ofBaseApp
{
public:
	testApp();

	void setup();
	void draw();

	ofEasyCam camera;
	ofLight light;
	of3dPrimitive primitive;

};

#include "testApp.h"

testApp::testApp()
{
}

void testApp::setup()
{
	ofEnableDepthTest();
	camera.setDistance(30);

	light.setPointLight();
	light.setGlobalPosition(300,150,200);
	light.enable();

	//comment out appends to test
	primitive.getMesh().append(ofMesh::box(10,10,10));
	primitive.getMesh().append(ofMesh::sphere(10));
	primitive.getMesh().append(ofMesh::cone(10,10));
}

void testApp::draw()
{
	ofClear(0);
	camera.begin();
		primitive.draw();
	camera.end();
}

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 636