コード例 #1
0
ファイル: framegl.cpp プロジェクト: gabrielalzamora/apikinect
/*!
 * \brief draw points cloud
 *
 * Draw 3d+color if pcloud_3d has data (size>0) and
 * draw 2d in red color at heigh=0 if pcloud_2d >0
 */
void FrameGL::drawCloud()
{
    glPointSize(1.0f);
    glBegin(GL_POINTS);
        if(pcloud_3d.size()>0){
            for(int i = 0; i < pcloud_3d.size(); i++){
                glColor3b(pcloud_3d[i].color.rgbRed,pcloud_3d[i].color.rgbGreen,pcloud_3d[i].color.rgbBlue);
                glVertex3s(pcloud_3d[i].x,pcloud_3d[i].y,pcloud_3d[i].z);
            }
        }

        glColor3ub(0,255,0);
        if(pcloud_2d.size()>0){
            for(int i = 0; i < pcloud_2d.size(); i++){
                glVertex3s(pcloud_2d[i].x,0,pcloud_2d[i].z);
            }
        }
    glEnd();
    pcloud_3d.resize(0);
    pcloud_2d.resize(0);
}
コード例 #2
0
void testApp::drawAxes(float size) {
	ofPushMatrix();
	ofScale(size, size, size);
	ofPushStyle();
	ofSetLineWidth(2.0);
	ofSetColor(255, 0, 0);
	glBegin(GL_LINES);
	glVertex3s(0, 0, 0);
	glVertex3s(1, 0, 0);
	glEnd();
	ofSetColor(0, 255, 0);
	glBegin(GL_LINES);
	glVertex3s(0, 0, 0);
	glVertex3s(0, 1, 0);
	glEnd();
	ofSetColor(0, 0, 255);
	glBegin(GL_LINES);
	glVertex3s(0, 0, 0);
	glVertex3s(0, 0, 1);
	glEnd();
	ofPopStyle();
	ofPopMatrix();
}
コード例 #3
0
ファイル: ColorPick.cpp プロジェクト: heptadecagram/cubish
// The display callback function.  Draws squares of color.
void Color_Display() {
	glClear(GL_COLOR_BUFFER_BIT);

	// Part is a logical unit of the window's size
	auto Part = Color_Window_Size/33.0;

	// Draw four quadrants in the window
	for(auto n1 = 0; n1 < 4; ++n1) {
		// This switch handles the quadrant translations
		switch(n1) {
		case 0:
			glTranslated(Part, Part, 0);
			break;
		case 1:
			glTranslated(Part*17, Part, 0);
			break;
		case 2:
			glTranslated(Part, 17*Part, 0);
			break;
		case 3:
			glTranslated(17*Part, 17*Part, 0);
			break;
		default:
			break;
		}

		// For each column
		for(auto n2=0; n2<4; n2++) {
			glTranslated(4*n2*Part, 0, 0);

			// For each row
			for(auto n3=0; n3<4; n3++) {
				glTranslated(0, 4*n3*Part, 0);

				// If this is the old color, draw a white box
				// around it to let the user know which one it
				// is
				if(static_cast<int>(Window_Color->Get_Red()*3)==n1 &&
						static_cast<int>(Window_Color->Get_Green()*3)==n2 &&
						static_cast<int>(Window_Color->Get_Blue()*3)==n3) {
					glColor3d(.8, .8, .8);
					glLineWidth(2);
					glBegin(GL_LINE_STRIP); {
						glVertex3d( -Part/2,  -Part/2, 0);
						glVertex3d(7*Part/2,  -Part/2, 0);
						glVertex3d(7*Part/2, 7*Part/2, 0);
						glVertex3d( -Part/2, 7*Part/2, 0);
						glVertex3d( -Part/2,  -Part/2, 0);
					} glEnd();
				}

				// Draw the color, based on where we are
				glColor3d(n1/3.0, n2/3.0, n3/3.0);
				glBegin(GL_QUADS); {
					glVertex3s(0, 0, 0);
					glVertex3s(3*Part, 0, 0);
					glVertex3s(3*Part, 3*Part, 0);
					glVertex3s(0, 3*Part, 0);
				} glEnd();

				// Move back
				glTranslated(0, -4*n3*Part, 0);
			}
			// Move back
			glTranslated(-4*n2*Part, 0, 0);
		}

		// Move back for the last time
		switch(n1) {
		case 0:
			glTranslated(-Part, -Part, 0);
			break;
		case 1:
			glTranslated(-17*Part, -Part, 0);
			break;
		case 2:
			glTranslated(-Part, -17*Part, 0);
			break;
		case 3:
			glTranslated(-17*Part, -17*Part, 0);
			break;
		default:
			break;
		}
	}

	// Draw everything
	glutSwapBuffers();
}
コード例 #4
0
void testApp::boxOutline(ofxPoint3f min, ofxPoint3f max) {
	ofPushMatrix();
	ofTranslate(min.x, min.y, min.z);
	ofScale(max.x - min.x, max.y - min.y, max.z - min.z);
	glBegin(GL_LINES);
	// back
	glVertex3s(0, 0, 0);
	glVertex3s(1, 0, 0);
	glVertex3s(0, 0, 0);
	glVertex3s(0, 1, 0);
	glVertex3s(1, 1, 0);
	glVertex3s(1, 0, 0);
	glVertex3s(1, 1, 0);
	glVertex3s(0, 1, 0);
	// front
	glVertex3s(0, 0, 1);
	glVertex3s(1, 0, 1);
	glVertex3s(0, 0, 1);
	glVertex3s(0, 1, 1);
	glVertex3s(1, 1, 1);
	glVertex3s(1, 0, 1);
	glVertex3s(1, 1, 1);
	glVertex3s(0, 1, 1);
	// extrusion
	glVertex3s(0, 0, 0);
	glVertex3s(0, 0, 1);
	glVertex3s(0, 1, 0);
	glVertex3s(0, 1, 1);
	glVertex3s(1, 0, 0);
	glVertex3s(1, 0, 1);
	glVertex3s(1, 1, 0);
	glVertex3s(1, 1, 1);
	glEnd();
	ofPopMatrix();
}
コード例 #5
0
ファイル: GEMglVertex3s.cpp プロジェクト: avilleret/Gem
/////////////////////////////////////////////////////////
// Render
//
void GEMglVertex3s :: render(GemState *state) {
	glVertex3s (x, y, z);
}
コード例 #6
0
ファイル: main.cpp プロジェクト: sriankit/CGraphix
void Draw(float a[8][3]) {               //Display the Figure
    int i;
    glColor3f (0.1, 0.7, 0.7);
    glBegin(GL_POLYGON);
    glVertex3f(a[0][0],a[0][1],a[0][2]);
    glVertex3f(a[1][0],a[1][1],a[1][2]);
    glVertex3f(a[2][0],a[2][1],a[2][2]);
    glVertex3f(a[3][0],a[3][1],a[3][2]);
    glEnd();
    i=0;
    glColor3f (0.8, 0.6, 0.1);
    glBegin(GL_POLYGON);
    glVertex3s(a[0+i][0],a[0+i][1],a[0+i][2]);
    glVertex3s(a[1+i][0],a[1+i][1],a[1+i][2]);
    glVertex3s(a[5+i][0],a[5+i][1],a[5+i][2]);
    glVertex3s(a[4+i][0],a[4+i][1],a[4+i][2]);
    glEnd();
    glColor3f (0.8, 0.4, 0.7);
    glBegin(GL_POLYGON);
    glVertex3f(a[0][0],a[0][1],a[0][2]);
    glVertex3f(a[3][0],a[3][1],a[3][2]);
    glVertex3f(a[7][0],a[7][1],a[7][2]);
    glVertex3f(a[4][0],a[4][1],a[4][2]);
    glEnd();
    i=1;
    glColor3f (0.5, 0.3, 0.3);
    glBegin(GL_POLYGON);
    glVertex3s(a[0+i][0],a[0+i][1],a[0+i][2]);
    glVertex3s(a[1+i][0],a[1+i][1],a[1+i][2]);
    glVertex3s(a[5+i][0],a[5+i][1],a[5+i][2]);
    glVertex3s(a[4+i][0],a[4+i][1],a[4+i][2]);
    glEnd();
    i=2;
    glColor3f (0.5, 0.9, 0.2);
    glBegin(GL_POLYGON);
    glVertex3s(a[0+i][0],a[0+i][1],a[0+i][2]);
    glVertex3s(a[1+i][0],a[1+i][1],a[1+i][2]);
    glVertex3s(a[5+i][0],a[5+i][1],a[5+i][2]);
    glVertex3s(a[4+i][0],a[4+i][1],a[4+i][2]);
    glEnd();
    i=4;
    glColor3f (0.7, 0.1, 0.4);
    glBegin(GL_POLYGON);
    glVertex3f(a[0+i][0],a[0+i][1],a[0+i][2]);
    glVertex3f(a[1+i][0],a[1+i][1],a[1+i][2]);
    glVertex3f(a[2+i][0],a[2+i][1],a[2+i][2]);
    glVertex3f(a[3+i][0],a[3+i][1],a[3+i][2]);
    glEnd();
}
コード例 #7
0
inline void glVertex( const GLdouble & x, const GLdouble & y, const GLdouble & z )	{ glVertex3s( x, y, z ); }
コード例 #8
0
inline void glVertex( const GLfloat & x, const GLfloat & y, const GLfloat & z )		{ glVertex3s( x, y, z ); }
コード例 #9
0
inline void glVertex( const GLshort & x, const GLshort & y, const GLshort & z )		{ glVertex3s( x, y, z ); }
コード例 #10
0
ファイル: gl.cpp プロジェクト: dschaefer/swt-opengl
M(void, glVertex3s, jshort x, jshort y, jshort z) {
	glVertex3s(x, y, z);
}