-1

So i think this is the part of my code that has the error. I think im not sending my array correctly or its something different when trying to add my vertex vectors.

void tetrahedron(GLfloat vertice[6][3])
{
glTranslatef(0.3f, 0.0f, 0.0f);
glRotatef(45.0f, 0.0, 1.0, 0.0);
glRotatef(45.0f, 0.0, 0.0, 1.0);
//Cara1
glBegin(GL_QUADS);
glColor3f(0.1, 0.0, 0.9);
GLfloat temp[3];
temp = vertice[2] + vertice[5] + vertice[0];
glVertex3fv(temp);
glVertex3fv(temp);
glVertex3fv(temp);
glEnd();
}

The error is C2110: '+': cannot add two pointers

in: temp = vertice[2] + vertice[5] + vertice[0];

void octahedron(GLfloat vertice[6][3])
{
glTranslatef(0.0f, 0.0f, -5.0f);
glRotatef(45.0f, 0.0, 1.0, 0.0);
glRotatef(45.0f, 0.0, 0.0, 1.0);
}

nothing special there

In the next function is where i create my array that im trying to send to octahedron and tetrahedron:

void display(void)   // Creamos la funcion donde se dibuja
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Limiamos pantalla y Depth Buffer 
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();                                   // Reinicializamos la actual matriz Modelview

GLfloat vertice[6][3] = {
{0.0, 0.5, 0.0},        //arriba
{ 0.0,-0.5,0.0 },   //abajo
{ 0.5,0.0,0.0 },    //izq
{ -0.5,0.0,0.0 },   //der
{ 0.0,0.0,0.5 },    //frontal
{ 0.0,0.0,-0.5 },   //trasero
};

octahedron(vertice);
tetrahedron(vertice);
glFlush();
}

1 Answers1

0

Found my problem, it was that i forgot how to add arrays in general. Solved with a for and stuff:

GLfloat temp[3];
int i;

//cara 1
for ( i = 0; i < 3; i++); {
    temp[i]= (vertice[2][i]) + (vertice[5][i]) + (vertice[0][i]);
}