As mentioned in my previous entry, a recangle can be displayed using a graphics library such as OpenGL as a list of triangles. Defining triangles for us is still an issue. Sometimes our rectangles would be "filipped" if we specify at least one vertex in wrong order. We tried to mitigate this by "sorting" our points based on stack overflow answers to similar issue. However we didn't succeed. The temporary solution was to tell the graphics card explicity to draw all faces of triangles, so even if triangles were fliped, they would be still drawn. Graphics cards by default don't draw back faces of the mesh so half of our rectangle could appear to be missing.
Texturing on the other hand uses yet different coordinate systems. Given a texture, we have to specify 2-D coordinates that map on the mesh, using only values between 0 and 1. Point (0,0) is top left corner of the mesh and (1,1) is bottom right. So we need to take our 4 or 6 vertices of the ractangle and map texture to them. That gave us a bit of a headache.
However this week we were in most cases able to display a textured rectangle as seen on the picture below:
![]() |
| Textured rectangle projected on top of the paper |
With the recangle sometimes displaying as "half flipped", texturing would also suffer from that issue. Sometimes as we move the paper around, half of the book cover would be inverted or mirrored. That means we still need to fix sorting 3-D points clockwise.
With the weekend ahead of us and the demo day coming in just 4 days, we need to find a way to change between different scenarios we prepared and to fix the sorting issue before we are ready for the presentation.

No comments:
Post a Comment