本文整理汇总了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();
}
示例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;
}
示例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();
}
}
}
示例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);
}
示例5: drawPlatform
void drawPlatform(glm::mat4 VP, GLfloat xpos, GLfloat ypos, GLfloat zpos) {
cube.drawCube(VP, xpos, ypos, zpos);
}
示例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();
}