glTexCoord2i?
I've always been using glTexCoord2f and just wanted to try out 2i.. but it didn't work (texture doesn't show up at all) and I don't know what I'm doing wrong. Do you have a small piece of example code for me?
Does glTexCoord2i map to the actual pixel coordinates of a texture or not?
[edited by - Baraclese on December 18, 2003 5:20:00 PM]
If you use "glTexCoord2f", the value must be in float (ex : 1.0f, 0.5f, etc ...) and with the "glTexCoord2i", your value must be in integer. So if you use float values for "glTexCoord2i", perhaps that is your trouble.
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
Yes if you call glTexCoord2i(0.2f, 0.7f) it will not hit the same texel as if you were calling glTexCoord2f(0.2f, 0.7f);
What is your graphics card / driver combo ?
NeHe reported that some implementations did not very well with texture coordinates other than floats.
NeHe reported that some implementations did not very well with texture coordinates other than floats.
glTexCoord2i should take values like this:
glBegin(GL_QUADS);
glTexCoord2i( 1, 0);
glVertex3f(vTarget.x+vStrafe.x-vView.x, vTarget.y+vStrafe.y-vView.y, vTarget.z+vStrafe.z-vView.z);
glTexCoord2i( 1, 1);
glVertex3f(vTarget.x+vStrafe.x+vView.x, vTarget.y+vStrafe.y+vView.y, vTarget.z+vStrafe.z+vView.z);
glTexCoord2i( 0, 1);
glVertex3f(vTarget.x-vStrafe.x+vView.x, vTarget.y-vStrafe.y+vView.y, vTarget.z-vStrafe.z+vView.z);
glTexCoord2i( 0, 0);
glVertex3f(vTarget.x-vStrafe.x-vView.x, vTarget.y-vStrafe.y-vView.y, vTarget.z-vStrafe.z-vView.z);
glEnd();
Make sure you verteces are counter-clockwise or clockwise order if you have culling enabled.
glBegin(GL_QUADS);
glTexCoord2i( 1, 0);
glVertex3f(vTarget.x+vStrafe.x-vView.x, vTarget.y+vStrafe.y-vView.y, vTarget.z+vStrafe.z-vView.z);
glTexCoord2i( 1, 1);
glVertex3f(vTarget.x+vStrafe.x+vView.x, vTarget.y+vStrafe.y+vView.y, vTarget.z+vStrafe.z+vView.z);
glTexCoord2i( 0, 1);
glVertex3f(vTarget.x-vStrafe.x+vView.x, vTarget.y-vStrafe.y+vView.y, vTarget.z-vStrafe.z+vView.z);
glTexCoord2i( 0, 0);
glVertex3f(vTarget.x-vStrafe.x-vView.x, vTarget.y-vStrafe.y-vView.y, vTarget.z-vStrafe.z-vView.z);
glEnd();
Make sure you verteces are counter-clockwise or clockwise order if you have culling enabled.
*News tagenigma.com is my new domain.
Baraclese, a much better idea is for you to post the code
that you are using, so we can see what''s happening (or not).
Kami no Itte ga ore ni zettai naru!
that you are using, so we can see what''s happening (or not).
Kami no Itte ga ore ni zettai naru!
神はサイコロを振らない!
I was just using textures that had several subtextures in it and addressed them with glTexCoord2f and it worked fine and then I thought oh it would be much easier to specify the texture coordinates with integers because I thought it would map directly to the pixels.
Anyway, does glTexCoord2i clamp the values to 0 - 1? That doesn''t make it particularly useful in my case, especially so if some cards have problems with that call
I''m using a GF2 GTS with 4.13.01.3082 drivers..
Anyway, does glTexCoord2i clamp the values to 0 - 1? That doesn''t make it particularly useful in my case, especially so if some cards have problems with that call

Unless you are using rectangular textures (GL_NV_texture_rectangle, GL_EXT_texture_rectangle), texture coordinates are always in the 0..1 range no matter which version of glTexCoord you call.
---I write code.DelphiGL (http://delphigl.cfxweb.net)
You should really check out the texture manipulation tutorial here.
*News tagenigma.com is my new domain.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement