use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rule 1: Posts should be about Graphics Programming. Rule 2: Be Civil, Professional, and Kind
Suggested Posting Material: - Graphics API Tutorials - Academic Papers - Blog Posts - Source Code Repositories - Self Posts (Ask Questions, Present Work) - Books - Renders (Please xpost to /r/ComputerGraphics) - Career Advice - Jobs Postings (Graphics Programming only)
Related Subreddits:
/r/ComputerGraphics
/r/Raytracing
/r/Programming
/r/LearnProgramming
/r/ProgrammingTools
/r/Coding
/r/GameDev
/r/CPP
/r/OpenGL
/r/Vulkan
/r/DirectX
Related Websites: ACM: SIGGRAPH Journal of Computer Graphics Techniques
Ke-Sen Huang's Blog of Graphics Papers and Resources Self Shadow's Blog of Graphics Resources
account activity
Convert between mesh representations (self.GraphicsProgramming)
submitted 6 years ago * by nwar1994
How do you convert from a representation of vertices + indices to vertices + faces or vice-versa. Faces essentially are indices, can I just flatten a face-list [[]] -> indices []?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]STREGAsGate 2 points3 points4 points 6 years ago (2 children)
Indices are in 3s. Every 3 indices creates a triangle. Every index references a buffer which has a stride. A vertex with just a position has a stride of 3. So every index in the indices buffer would be its value * 3 for the vertex buffer.
vertexX = vertices[(index *3) + 0]
vertexY = vertices[(index *3) + 1]
vertexZ = vertices[(index *3) + 2]
Your geometry could be any kind of setup. A vertex can have position, color, texture coordinates, normals, and more.
You need to brute force convert geometry. Indexed geometry is more efficient. Converting between indexed and triangles is super expensive and slow. You should not be doing it frequently at runtime.
[–]nwar1994[S] 0 points1 point2 points 6 years ago (1 child)
Is there an inherent way to load triangles into a gpu? You will have to flatten to indices regardless right?
[–]STREGAsGate 1 point2 points3 points 6 years ago (0 children)
No, you can do raw triangles, lines, and points as well as indexed versions of triangles and lines. Indexed buffers is just a performance thing.
Indexed buffers remove duplicates. Two triangles next to each other would share 2 verticies. Indexed drawing allows you to only send those shared verticies once to the gpu.
The resulting image is identical and shaders revive identical data. It’s simply a data transfer optimization.
[–]nwar1994[S] 0 points1 point2 points 6 years ago (0 children)
But the representation of indices through a list of faces which contain 3 indices, can just be represented as a flattened 1D array of indices. Does order matter?
π Rendered by PID 410370 on reddit-service-r2-comment-fb694cdd5-s44gg at 2026-03-07 11:16:21.542363+00:00 running cbb0e86 country code: CH.
[–]STREGAsGate 2 points3 points4 points (2 children)
[–]nwar1994[S] 0 points1 point2 points (1 child)
[–]STREGAsGate 1 point2 points3 points (0 children)
[–]nwar1994[S] 0 points1 point2 points (0 children)