简体   繁体   中英

Texturing 3d polygons in OpenGL with C++

I'm new to OpenGL and programming in general and I'm trying to paste any picture on all surfaces of a cube and a pyramid so the picture can move with them and rotate with them I tried a lot of tutorials but most of them focus on 2d or with other programming languages like C#. how can I make texturing to my polygons

[...] but most of them focus on 2d [...]

You have to wrap 2d textures around the 3d mesh. Put different parts of a 2d texture on the faces of the 3d mesh. Each face of the 3d object is 2 dimensional. You have to define the texture coordinate attributes for each vertex of a face (respectively primitive), to select an area of the 2d texture, to display on the primitive.
See also How do opengl texture coordinates work? .

Note, 3d textures contain Voxels that's something completely different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM