I figure just as long as you guys don't know the company it can't hurt. Also I am leaving out a lot of questions so it should be okay. If I get blackballed from the gaming community for trying to learn then so be it.
Anyway here are some 3d questions.
Quote: "We are using Euler angles to represent the orientation of an object in 3D space (rotation around X, Y and Z)
a. What is the classical problem that we will face?
b. What is the usual solution to avoid it?"
Quote: "In OpenGL, why is rendering with vertex arrays better than rendering with immediate mode?"
Quote: "Why bother with interleaved arrays?"
Quote: "You have this code:
GLfloat coords[4][12] = {
{ /* coords of an object (a quad) */ },
{ /* ... */ },
{ /* ... */ },
{ /* ... */ }
};
GLfloat colors[4][12] = {
{ /* colors of vertices of first object */ },
{ /* ... */ },
{ /* ... */ },
{ /* ... */ }
};
Matrix4 matrices[4] = { /* ... */ };
for (int i = 0; i < 4; ++i)
{
glPushMatrix();
glLoadMatrixf(matrices[i].pointer());
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, coords[i]);
glColorPointer(3, GL_FLOAT, 0, colors[i]);
glDrawArrays(GL_QUADS, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glPopMatrix();
}
Optimize it :
Note, Matrix4 class is used as to represent a 4x4 matrix. Its methods can be used to perform matrix operations and data manipulation."
Quote: "The following code
GLint vertices[9][2] = {{0, 0}, {2, 1}, {1, 2}, {2, 0}, {0, 1}, {1, 0}, {0, 2}, {1, 1}, {2, 2}};
GLubyte indices[8][3] = {{5, 1, 7}, {4, 2, 6}, {7, 1, 8}, {0, 7, 4}, {5, 3, 1}, {7, 8, 2}, {0, 5, 7}, {4, 7, 2}};
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_INT, 0, &vertices[0][0]);
glDrawElements(GL_TRIANGLES, 24, GL_UNSIGNED_BYTE, &indices[0][0]);
draws this:
(0,2) (1,2) (2,2)
+-------+-------+
| /| /|
| / | / |
| / | / |
| / | / |
| / | / |
| / | / |
|/ (1,1)|/ |
(0,1) +-------+-------+ (2,1)
| /| /|
| / | / |
| / | / |
| / | / |
| / | / |
| / | / |
|/ |/ |
+-------+-------+
(0,0) (1,0) (2,0)
a. Describe two problems with this rendering procedure, and why they are problems.
b. How can the code be improved?"
Quote: "Suppose a floor is modeled with square tiles, and each tile is placed by transforming a quad from its canonical representation, say at the origin with unit side lengths, to its final position and size. Strangely, when we render the scene, we can sometimes see small crack appearing between tiles, even if mathematically the vertices of neighbouring tiles are identical.
a.Why is that?
b.How to solve this problem?"
So here are just a few of the ones that I had no idea about and would really like to know how to solve them.
Again thanks for the response and hopefully both of us will learn a lot from it.