当前位置: 首页>>代码示例>>C++>>正文


C++ Cube::drawCube方法代码示例

本文整理汇总了C++中Cube::drawCube方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::drawCube方法的具体用法?C++ Cube::drawCube怎么用?C++ Cube::drawCube使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cube的用法示例。


在下文中一共展示了Cube::drawCube方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawScene

void drawScene() {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	
	glTranslatef(0, 0, -50);
	draw_meta();

	glPushMatrix();
	// Establish view 
	glRotatef(35, 1,0, 0);
	glRotatef(-20, 0, 1, 0);

	// Display some text


	// Draws the cube and handles movement  
	c.drawCube();
	
	// Update the board and see if cube didn't fall
	p.update();

	// Draw the level
	p.draw_level();
	glPopMatrix();
	
	glutSwapBuffers();
}
开发者ID:inge91,项目名称:cubeGame,代码行数:30,代码来源:main.cpp

示例2: desenLabirint

void Actions::desenLabirint(char* fisin, int dim, int lungime, int latime, std::vector<Cub*> *v, int *vectorPereti) {
	Cube cube;
	//in acest vector adaugam toate coordonatele libere si alegem la intamplare pozitii din acest vector pentru celelalte obiecte din labirint
	/*std::vector<Vector3D> spatii;*/
	float i, j;
	float lung = (float)lungime/2;
	float lat = (float)latime/2;
	i = -lung;
	j = -lat;
	std::string str(fisin);
	std::ifstream infile(fisin);
	std::string line;
	std::srand((unsigned)time(0));
	while (getline(infile, line)) {
		//deseneaza labirintul
		std::string::iterator it;
		for (it = line.begin(); it < line.end(); it++) {
			if ((*it) == '*') {
				if (*vectorPereti == 0) {
					//Cub* cub = new Cub(Vector3D(dim*i+(double)dim/2, 0, dim*j + (double)dim/2), Vector3D(0.66, 0.27, 0.07));
					//in cub pastram coordonatele a doua colturi opuse din cub
					Cub* cub = new Cub(Vector3D(dim*i, -(double)dim/2, dim*j), Vector3D(dim*(i+1), (double)dim/2, dim*(j+1)));
					(*v).push_back(cub);
				}
				glPushMatrix();
					glColor3f(0.54, 0.53, 0.47);
					glTranslatef(dim*i + (double)dim/2, 0, dim*j + (double)dim/2);
					cube.drawCube(dim);
				glPopMatrix();
			}
			else {
				if (*vectorPereti == 0)
					spatii.push_back(Vector3D(dim*i + (double)dim/2, 0, dim*j + (double)dim/2));
			}
			//std::cout << *it;	
			i++;
		}
		i = -lung;
		j++;
		std::cout << std::endl;
	}
	if (*vectorPereti == 0) {
		int dim = spatii.size();
		int random_int = std::rand() % dim;
		std::cout << random_int;
		tor = spatii[random_int];
		int random_int1 = std::rand() % dim;
		while (random_int1 == random_int) {
			random_int1 = std::rand() % dim;
		}
		erou = spatii[random_int1];
		indexErou = random_int1;
	}
	(*vectorPereti) = 1;
}
开发者ID:fullvlad,项目名称:Andreea,代码行数:55,代码来源:actions.cpp

示例3: drawTerrain

void Actions::drawTerrain(int lungime, int latime) {
	Cube cube;
	float i, j;
	float lung = (float)lungime/2;
	float lat = (float)latime/2;
	glColor3f(0, 0, 0.7);
	for (i = -lung; i < lung; i++) {
		for (j = -lat; j < lat; j++) {
			glPushMatrix();
				glColor3f(0, 0, 0.7);
				glTranslatef(i + 0.5, -0.5, j + 0.5);
				cube.drawCube(3);
			glPopMatrix();
		}
	}
}
开发者ID:fullvlad,项目名称:Andreea,代码行数:16,代码来源:actions.cpp

示例4: drawTile

 void drawTile(glm::mat4 VP) {
     //printf("%f %f %f\n", xpos, ypos, zpos );
     tile_cube.drawCube(VP, tile_x, tile_y, tile_z);
 }
开发者ID:shivtej1505,项目名称:Contra-3D,代码行数:4,代码来源:Tile.cpp

示例5: drawPlatform

 void drawPlatform(glm::mat4 VP, GLfloat xpos, GLfloat ypos, GLfloat zpos) {
   cube.drawCube(VP, xpos, ypos, zpos);
 }
开发者ID:shivtej1505,项目名称:Contra-3D,代码行数:3,代码来源:Platform.cpp

示例6: displayCube

void displayCube() {
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers
   glMatrixMode(GL_MODELVIEW);     // To operate on model-view matrix
   rubiks.drawCube();
   glFlush();
}
开发者ID:GraphiCAT,项目名称:Textured-Rubiks-Cube,代码行数:6,代码来源:DrawHandler.cpp


注:本文中的Cube::drawCube方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。