Skip to the content.

Texture Mapping

Texture Maping (GL)

Parameters

//Enable Texture Mapping 
glEnable(GL_TEXTURE_2D);
//Make Texture using the image
glGenTextures(1, &_textureId)
glBindTexture(GL_TEXTURE_2D, _textureId);
glTexImage2D(...);
//Setting parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//Adjusting Texture Coordinates
glTexCoord2f(...)

Simple Demo

Object loading

3D model files

OBJ file (.obj)

MTL file (.mtl)

Simple Demo

for example this is the apple ibook model

3D model with texture mapping

Example

2D Image 3D Model Result
+ =

Note:

Models with texture images are not required in this course.

Section Demos

Demos are available here.