Assignment 2 Questions - Last Updated Nov 3
Q: What should I do to handle groups?
A: If you are not doing the group bonus you can simply ignore the groups. If
you are doing the group bonus you can either load each group as its own seperate
mesh object, or you could have a marker within each Face object that tells you
which group the face is a part of . . . it's up to you.
Q: The cow mesh has faces entries like "2 123/123/123 124/124/124 124/124/124".
What are these extra parameters and what should I do with them?
A: Faces are actually of the form:
"face_number vertex_index/texture_index(vt)/normal_index(vn) vertex_index/texture_index(vt)/normal_index(vn) . . ."
For this assignment we are not using predefined vertex normals (vn entries) nor are we using vertex texture coordinates (vt entries) so this means you can
ignore these parts of the face entries.
Q: The parser doesn't need to take the filename as a command line argument, correct? So I can just run it from my a2.cpp?
A: Your parser should probably be a function of a mesh object (that you create). This function would take a filename (as an array of chars) and find the file, and load the mesh information into your mesh object. To have the user specify which file you could use command line arguments, although I don't recommend it. Instead I recommend you use the QT file dialog to select and open files. Check the QT documentation on this for details but the file dialog is super easy to use.
Q: To draw a mesh, we essentially do the same as GL_LINE.. but do we use GL_TRIANGLES, or POLYGONS, or something else?
A: For the assignment you are going to draw the mesh two different ways. One is a wireframe. For this you draw the edges of each face as GL_LINES. The other way you will render the mesh is as a bunch of flat faces. This means you are rendering polygons. You have to handle polygons/faces with any number of edges. You can render these as polygons, i.e., glBegin(GL_POLYGON), if you like or you can split them into triangles and render the triangles. It's up to you.
Q: What is the convention in differentiating between a vector.h vector, and a linear algebra Vector?
A: Generally in my programs, my 3D geometry vector class is called jbVector and the standard template library vectors are vector (of course). It you want to get funky you can look at dealing with namespaces where the STL vectors are std::vector and your vectors might be jb::vector. It's up to you, I won't care which you use so feel free to do whatever you find easiest.
Q: How do I get my widgets to resize when I resize the form?
A: Right click on your form and select lay-out in grid. Most likely the positions of widgets on your form will change wildly. But if you drag the form wider or taller you will notice that the widgets expand to fit the form. So undo your changes and then play with adding layouts to groups of your widges until they no longer too wildly when you go to the form and select lay-out in grid.
Q: In the program specifications point 2 it talks about performing translation, scaling, and rotations around the main axes of the object. Does this mean that for rotations we have to translate to the origin, rotate, and then translate back?
A: Yes this is how you are to perform rotations.
Q: Also what are the main axes of the object?
A: These the vectors (1,0,0), (0,1,0), and (0,0,1) for your x, y and z axes respectively. These vectors come out of the center of your object. So how do you find the center of your object? Any way that seems suitable. Two different suggestions I have come up with off of the top of my head are: (1) Take the average of all the vertices or (2) find the numbers corresponding to the max & min x, max & min y, and the max & min z and choose the center as the midpoint of this ((maxX+minX)/2,(maxY+minY)/2,(maxZ+minZ)/2). Basically do whatever you want so long as your approximation is reasonable . . . it doesn't have to be perfect.