Knockr wrote:
> Thanks for your reply.
>
> my code for the same would look as follows
>
> void ChangeSize(int w, int h)
> {
> // Set View****t to window dimensions
> glView****t(0, 0, w, h);
>
> win_h = w;
> win_w = h;
>
> // Reset coordinate system
> glMatrixMode(GL_PROJECTION);
> glLoadIdentity();
> glOrtho(0, win_w, 0, win_h, -1.0, 1.0);
>
> glMatrixMode(GL_MODELVIEW);
> glLoadIdentity();
> glutPostRedisplay();
> }
Here's some advice: Don't do it that way. glView****t and setting
the matrices are very cheap calls. The best practice to do the
whole setup just right before the rendering. So your display()
function would look like
void display()
{
glView****t(0, 0, win_w, win_h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, win_w, 0, win_h, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* render that stuff */
}
the reshape function would simplify to something like
void ChangeSize(int w, int h)
{
win_w = w;
win_h = h;
glutPostRedisplay();
}
> the extra ****tion of the displaying window look as black when
> CLAMP_TO_EDGE parameter. Otherwise the something like repeat
> effect. but the texture never rendered full view****t
Well, did you try GL_GLAMP (just CLAMP, nothing more)? Normally,
if there's no border supplied, GL_CLAMP_TO_BORDER should exhibit
the same behavior as GL_CLAMP, but some drivers might break
that.
Oh, and something I totally missed before: You actually _made_
some mistake: TEXTURE_RECTANGLE textures are addressed in
absolute pixels, not in relative [0, 1]^n coordinates, so you've
to write:
glEnable(GL_TEXTURE_RECTANGLE_ARB);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, TextureImage[i]->texID);
GLint tex_w = TextureImage[i]->sizeX;
GLint tex_w = TextureImage[i]->sizeY;
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex2f(0.0, 0.0);
glTexCoord2i(tex_w, 0);
glVertex2f(win_w, 0.0);
glTexCoord2i(tex_w, tex_h);
glVertex2f(win_w, win_h);
glTexCoord2i(0, tex_h);
glVertex2f(0.0, win_h);
glEnd();
Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith@[EMAIL PROTECTED]
ICQ: 134682867


|