texture mapping - Image size

Hi, everyone.
I am trying do some texture mapping.
I know that the image size should be in the form of 2^n. (ie. 2, 4, 8, 16, etc.)
The problem is the size of my image is 144(width) by 66(height). Is there any way to map this image on a surface without modifying it?

Put your 144x66 image on a 256x128 texture,
and only map to the 144x66 part.

There is also the GL_NV_texture_rectangle extension which allows you to use non-power of two texture dimensions. But there are several limitations, such as no border, or mipmapping, and you must specify the coordinates in image width and image height.
Also, it for nVidia hardware only. But there seems to be (GL_EXT_texture_rectangle) an undocumented extension (Not on SGI’s page) for ATI cards. It uses the same constant values as the NV extension, but you should still check the documentation for it. It’s only on Apple’s site (why, I have no idea) It MIGHT be supported on other OS’ but I have no idea. Here it is: http://developer.apple.com/opengl/extensions/ext_texture_rectangle.html

[This message has been edited by Brian Jones (edited 05-08-2003).]

Thanks guys for the help!

well, now i am tryting to do 64(height) by 128(width) texture mapping.
However, for some reasons, it is only drawing the half of the image.

here are the settings for my texture mapping. can anyone tell me what is wrong with this code?

#define imageWidth 64
#define imageHeight 128

…other stuff…

GLubyte image[3imageWidthimageHeight];
GLfloat textps[2][2][2] = {{{0.0,0.0}, {0.0, 1.0}},{{1.0,0.0}, {1.0,1.0}}};

…other stuff for drawing a surface…

void makeImage(void)

… the stuff…


void init(void)

glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, &texpts[0][0][0]);
glTexEnvf(gl_texture_env, gl_texture_env_mode, gl_blind);
glTexParameteri(gl_texture_2d, gl_texture_wrap_s, gl_repeat);
glTexParameteri(gl_texture_2d, gl_texture_wrap_t, Gl_repeat);
glTexParameteri(gl_texture_2d, gl_mag_filter, gl_nearest);
glTexParameteri(gl_texture_2d, gl_texture_min_filter, Gl_nearest);
glTexImage2D(GL_TEXTURE_2D, 0, 3, imageWidth, imageHeight, 0, GL_RGB, GL_UNSIGHED_BYTE, image);

please let me know if there is anything missing or if I need to delete any.

  1. You can check you are loading your texture correctly using drawpixels just to draw it to the screen.
  2. Show us how your bind it to your polygon