Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > Texture Fit to ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 4881 of 5017
Post > Topic >>

Texture Fit to Window

by Knockr <CSarath@[EMAIL PROTECTED] > Aug 22, 2008 at 02:21 AM

Dear All,

I've created an OpenGL program to load and draw a texture. Texture is
having 800x600 size. but the window has 1440x900 pixels size.

the projection is of type orthogonal - glOrtho(0, win_w, 0, win_h,
-1.0, 1.0);

the texture is loaded as follows
glTexImage2D( GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, TextureImage[i]-
>sizeX, TextureImage[i]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE,
TextureImage[i]->data );

the textures are mapped as follows

glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);

glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);	glVertex2f(0.0, 0.0);
glTexCoord2f(1, 0.0);	glVertex2f(win_w, 0.0);
glTexCoord2f(1, 1);		glVertex2f(win_w, win_h);
glTexCoord2f(0.0, 1);	glVertex2f(0.0, win_h);
glEnd();

How can make the texture fit to window?
 




 5 Posts in Topic:
Texture Fit to Window
Knockr <CSarath@[EMAIL  2008-08-22 02:21:22 
Re: Texture Fit to Window
Wolfgang Draxinger <wd  2008-08-22 13:00:57 
Re: Texture Fit to Window
Knockr <CSarath@[EMAIL  2008-08-22 05:25:37 
Re: Texture Fit to Window
Wolfgang Draxinger <wd  2008-08-22 14:52:06 
Re: Texture Fit to Window
Knockr <CSarath@[EMAIL  2008-08-27 04:00:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 6:43:51 CST 2008.