Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Mapping -

Started by Jamazon Nov 24, 2001 at 3:42 PM 1 replies 350+ views
Original Post
Jamazon
Jamazon
Hi I am new to opengl and have read some of the NeHe tutorials. I started making a small 3d demo using different textures and I noticed that the tuxture was always strecthed to fit the polygon it was put on. Say i had a bitmap that looked like a brick and wanted the brick to go on one side of the wall but not strecth - just repeat, making it look like a brick wall. How would I do this, has it got somethiingm to do with these 2 lines?: glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); Thanks.
Fruny
Fruny
Nope, it's these two


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );


The ones you gave control mipmapping.

Edit: cf Red Book p409

Edited by - Fruny on November 24, 2001 4:46:47 PM
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Wavarian
Wavarian
Um, i think you should be looking at the texture co-ords.

glTexCoord2f(0,0)
glTexCoord2f(1,0)
glTexCoord2f(1,1)
glTexCoord2f(0,1)

the above texture co-ordinates for a quad will make the texture stretch to fit the quad. Try changing the 1''s to 10''s and see how the texture is then tiled across the quad.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.