I created a plane in OpenGL using this code:
glBegin(GL_TRIANGLE_STRIP);
glColor4f(0.8, 0.8, 0.5, 1.0);
glVertex3f(startlen, height, startwid);
glVertex3f(startlen, height, startwid + width);
glVertex3f(startlen + length, height, startwid);
glVertex3f(startlen + length, height, startwid + width);
glEnd();
Now I want to apply a texture to this plane.
I read this tutorial here , but I focused on the part “Using Textures in OpenGL” because I do not have UV coordinates.
I know that we need to import a texture file, in my case a raster file.
The bootloader returns Glint, which is the textureID, is global? In the example, if I need to load this texture, do I just need to call the texture binding function with the specified identifier?
Anyway, how can I apply a texture to a plane?
. # 1:
.
, , , OpenGL.
, :)
, .
, , , ( , ).
, , :

, 2 :
# 2:
, !
.
:

, :

- 256x256 ( )
# 3:
glTexCoord2f ( ):
glTexCoord2f(0.0f, 0.0f); glVertex3f(startlen, height, startwid);
glTexCoord2f(0.0f, 1.0f); glVertex3f(startlen, height, startwid - width/2);
glTexCoord2f(1.0f, 0.0f); glVertex3f(startlen + length, height, startwid);
glTexCoord2f(1.0f, 1.0f); glVertex3f(startlen + length, height, startwid - width/2);