






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Juraj Obert [email protected] http://graphics.cs.ucf.edu/cap4720/fall2008/
tex2D(sampler1, vec2(0.27, 0.14)
What do we return from this function call?
1 2
(^3 )
tex2D(sampler1, vec2(0.27, 0.14)
What do we return from this function call?
1 2
(^3 )
Return the nearest texel
1 2
(^3 )
yi – color of the i-th texel ui – u-coordinate of the i-th texel vi – v-coordinate of the i-th texel
(u,v)
4 2
2
4 3
3 3 4 3
2 1
1 1 2 1
FINAL A B A
B
A
Nearest neighbor Bilinear
One Pixel
Pixel covers 0 texels
Pixel covers 1 texel
Push the object down the negative z-axis
u
v
d
Texture Interpolation Texture Pyramid
i
Nearest neighbor Bilinear Trilinear
// generate texture name, textures have numeric names in OpenGL, i.e. 1, 2, … glGenTextures(1, &tex);
// bind texture to current sampler glBindTexture(GL_TEXTURE_2D, tex);
// define how pixels are aligned in memory (compressed, uncompressed, etc..) glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// set up filtering modes glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// …
// set up texture coordinates modes glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// tell OpenGL where texels are glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, this->width, this->height, 0, GL_RGB, GL_UNSIGNED_BYTE, this->pixels);
This means that we want to access texels outside the original texture