void ofxMarchingCubes::debugDraw(){
	glColor3f(1.0f, 1.0f, 1.0f);
	drawFilled();
	glLineWidth(2.0f);
	glColor3f(0.0f, 0.0f, 0.0f);
	drawWireFrame();
	drawCube();
	//drawGrid();
}
Esempio n. 2
0
void Bond::drawPrivate(bool selected) 
{
   updateOrientation(); // This should only need calling if an atom is moving
   switch (m_drawMode) {
      case Primitive::BallsAndSticks:
         drawBallsAndSticks(selected);
         break;
      case Primitive::Tubes:
         drawTubes(selected);
         break;
      case Primitive::WireFrame:
         drawWireFrame(selected);
         break;
      default:
         break;
   }
}
Esempio n. 3
0
CGMainWindow::CGMainWindow (QWidget* parent, Qt::WindowFlags flags)
: QMainWindow (parent, flags) {
    resize (604, 614);

    // Create a nice frame to put around the OpenGL widget
    QFrame* f = new QFrame (this);
    f->setFrameStyle(QFrame::Sunken | QFrame::Panel);
    f->setLineWidth(2);

    // Create our OpenGL widget
    ogl = new MyTorus (this,f);

	// Create a menu
    QMenu *file = new QMenu("&Draw Methode",this);
    file->addAction ("&Wireframe", this->ogl, SLOT(drawWireFrame()), Qt::CTRL+Qt::Key_W);
    file->addAction ("&Flat-Shading",this->ogl,SLOT(flating()),Qt::CTRL+Qt::Key_F ),
    file->addAction ("&exact Smooth-Shading", this->ogl, SLOT(exactSmoothing()), Qt::CTRL+Qt::Key_S+Qt::Key_E);
    file->addAction ("&Smooth-Shading", this->ogl, SLOT(smoothing()), Qt::CTRL+Qt::Key_S);
    file->addAction ("Quit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);

    QMenu *colMenu = new QMenu("&Color",this);
    colMenu->addAction ("&Kupfer", this->ogl, SLOT(setKupfer()), Qt::CTRL+Qt::Key_K);
    colMenu->addAction ("&Rubin",this->ogl,SLOT(setRubin()),Qt::CTRL+Qt::Key_R ),
    colMenu->addAction ("&Smaragd", this->ogl, SLOT(setSmaragd()), Qt::CTRL+Qt::Key_M);
    colMenu->addAction ("&Silber", this->ogl, SLOT(setSilber()), Qt::CTRL+Qt::Key_I);

    menuBar()->addMenu(file);
    menuBar()->addMenu(colMenu);


	// Put the GL widget inside the frame
	QHBoxLayout* layout = new QHBoxLayout();
	layout->addWidget(ogl);
	layout->setMargin(0);
	f->setLayout(layout);

	setCentralWidget(f);

	statusBar()->showMessage("Ready",1000);
}
Esempio n. 4
0
void geode::frustum_draw(Matrix4 c, bool status) {
	getBounds(c);
	drawWireFrame(c, status);
	float m[16], p[16];

	glGetFloatv(GL_PROJECTION_MATRIX, p);
	glGetFloatv(GL_MODELVIEW_MATRIX, m);

	glPushMatrix();
	glLoadMatrixf(p);
	glMultMatrixf(m);
	glGetFloatv(GL_MODELVIEW_MATRIX, m);
	glPopMatrix();

	Matrix4 m2w = Matrix4(
		m[0], m[1], m[2], m[3],
		m[4], m[5], m[6], m[7],
		m[8], m[9], m[10], m[11],
		m[12], m[13], m[14], m[15]);

	Vector4 NEARP = Vector4(
		m2w.get(2, 0) + m2w.get(3, 0),
		m2w.get(2, 1) + m2w.get(3, 1),
		m2w.get(2, 2) + m2w.get(3, 2),
		m2w.get(2, 3) + m2w.get(3, 3));

	Vector4 FARP = Vector4(
		-m2w.get(2, 0) + m2w.get(3, 0),
		-m2w.get(2, 1) + m2w.get(3, 1),
		-m2w.get(2, 2) + m2w.get(3, 2),
		-m2w.get(2, 3) + m2w.get(3, 3));

	Vector4 BOTTOM = Vector4(
		m2w.get(1, 0) + m2w.get(3, 0),
		m2w.get(1, 1) + m2w.get(3, 1),
		m2w.get(1, 2) + m2w.get(3, 2),
		m2w.get(1, 3) + m2w.get(3, 3));

	Vector4 TOP = Vector4(
		-m2w.get(1, 0) + m2w.get(3, 0),
		-m2w.get(1, 1) + m2w.get(3, 1),
		-m2w.get(1, 2) + m2w.get(3, 2),
		-m2w.get(1, 3) + m2w.get(3, 3));

	Vector4 LEFT = Vector4(
		m2w.get(0, 0) + m2w.get(3, 0),
		m2w.get(0, 1) + m2w.get(3, 1),
		m2w.get(0, 2) + m2w.get(3, 2),
		m2w.get(0, 3) + m2w.get(3, 3));

	Vector4 RIGHT = Vector4(
		-m2w.get(0, 0) + m2w.get(3, 0),
		-m2w.get(0, 1) + m2w.get(3, 1),
		-m2w.get(0, 2) + m2w.get(3, 2),
		-m2w.get(0, 3) + m2w.get(3, 3));

	NEARP.normalize();
	FARP.normalize();
	BOTTOM.normalize();
	TOP.normalize();
	LEFT.normalize();
	RIGHT.normalize();

	float distance;
	int count = 0;
	Vector4 bounding = { boundingBox.x, boundingBox.y, boundingBox.z, 1 };
	bounding = m2w.multiply(bounding);
	bounding.normalize();
	Vector4 plane[6] = { NEARP, FARP, BOTTOM, TOP, LEFT, RIGHT };
	for (int i = 0; i < 6; i++) {
		distance = plane[i][0] * bounding.x + plane[i][1] * bounding.y + plane[i][2] * bounding.z + plane[i][3];
		if (distance < -radius) {
			break;
		}
		else {
			count++;
		}
	}

	if (count == 6) {
		render(c);
	}
}
Esempio n. 5
0
void geode::draw(Matrix4 c, bool status) {
	getBounds(c);
	setModeView(c);
	render(myObject);
	drawWireFrame(c, status);
}