Forceflow / trimesh2

C++ library and set of utilities for input, output, and basic manipulation of 3D triangle meshes
GNU General Public License v2.0
307 stars 72 forks source link

How can I render 3D model with texture? #6

Closed rnjena closed 5 years ago

rnjena commented 5 years ago

Hello forceflow, Thanks for your great work.

It helps me a lot.

How can I render 3D model with texture uv?

Could you give me an example?

Thanks!

Forceflow commented 5 years ago

Currently, mesh_view does not support texture rendering. You would have to implement it by writing the texture coordinates to a buffer, loading in the texture (using stb_image or whatever), and writing a shader to sample the texture buffer.

A good starting place is the excellent tutorial at: https://learnopengl.com/Getting-started/Textures A very, very, very basic OpenGL texture loading and rendering example can be found in my OpenGL starter project, but it's very barebones: https://github.com/Forceflow/opengl_viewer