-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What does the model.face mean? #23
Comments
Besides, does it have a way to draw 3D lines like OpenGL? |
Here I'll demostrate why I choose the non-intuitive Suppose you have a triangle ABC, whose vertices are Step 1: glBegin(GL_TRIANGLE);
glVertex(ax, ay);
glVertex(bx, by);
glVertex(cx, cy);
glEnd(); This is called the Intermediate Mode (IM) of OpenGL, which is well known among us. Step 2: triangle_vertices = [[ax, ay], [bx, by], [cx, cy]]
glDrawTriangle(triangle_vertices); But what if you want to draw two triangles, ABC and BCD? triangle1_vertices = [[ax, ay], [bx, by], [cx, cy]]
glDrawTriangle(triangle1_vertices);
triangle2_vertices = [[bx, by], [cx, cy], [dx, dy]]
glDrawTriangle(triangle2_vertices); See? If we want to draw n triangles, we have to invoke Step 3: triangles = []
triangles[0] = [[ax, ay], [bx, by], [cx, cy]]
triangles[1] = [[bx, by], [cx, cy], [dx, dy]]
glDrawTriangles(triangles); With this, we can draw multiple triangles within a single Step 4: vertices = [[ax, ay], [bx, by], [cx, cy], [dx, dy]]
triangles = []
triangles[0] = [0, 1, 2] # tell GL to find the vertex position from vertices[0], vertices[1], vertices[2]
triangles[1] = [1, 2, 3] # tell GL to find the vertex position from vertices[1], vertices[2], vertices[3]
glDrawTrianglesByIndex(vertices, triangles); And this become the final API design of latest OpenGL. Congrats! Now we learn that: |
Got it. Thanks. |
No, each element in a
Sorry about my poor explaination skills.. Here's the implementation in case you need it: taichi_three/taichi_three/model.py Lines 42 to 46 in e45f1b3
taichi_three/taichi_three/geometry.py Lines 84 to 90 in e45f1b3
Hope this helps :) |
Ah. Got it. Thanks. |
Hello,
Taichi_three looks like a really cool project to make taichi do greater demos!
Besides, what does model.face mean?
I am looking at the 'hello triangle' demo, but it is still a little bit confusing for me, because it doesn't look like OpenGL triangle convention. How should I interpret it?
Moreover, I believe a more thorough document than the one now can make this project popular soon :)
Thank you!
The text was updated successfully, but these errors were encountered: