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
Asked
Active
Viewed 218 times
1
-
1*"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. Note, 3d textures contain [Voxel](https://en.wikipedia.org/wiki/Voxel) that's somthing completely different. – Rabbid76 Jun 14 '20 at 12:04
1 Answers
1
[...] 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.

Rabbid76
- 202,892
- 27
- 131
- 174