LWJGL Forum

Programming => OpenGL => Topic started by: mutsop on June 30, 2012, 13:13:51

Title: background and how to scale images?
Post by: mutsop on June 30, 2012, 13:13:51
Hi, I have a few questions on images and scaling:

How does scaling of images work in LWJGL when increasing resolution?

So for a background is it better to have one big image? should I create this image at highest resolution? (so when we scale, the sharpness is at its maximum?
How would we fix the switch between widescreens(16:9) and standard resolution(4:3)? (so it doesn't stretches out the images).

Looking forward to an answer :)
Regards,
Muts
Title: Re: background and how to scale images?
Post by: dangerdoc on July 01, 2012, 14:54:50
Hi mutsop,
If you don't want your image to stretch, then you could just tile it (assuming that your image is tilable). If you use the slick library texture loader, you could just set the texture coordinates to a higher scale than 1f and it will tile. Hope this helps!
Title: Re: background and how to scale images?
Post by: mutsop on July 03, 2012, 06:40:51
What do you mean by 1f it?
So the idea is to tile my background? Is there any well written tutorial on how to do something like this?

Im not really good at creating gui's :)
Title: Re: background and how to scale images?
Post by: frostyfrog on July 06, 2012, 04:45:48
Quote from: mutsop on July 03, 2012, 06:40:51
What do you mean by 1f it?
So the idea is to tile my background? Is there any well written tutorial on how to do something like this?

Im not really good at creating gui's :)
What dangerdoc means (at least from what I can tell) is if you followed this tutorial (http://www.lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_1_-_Loading_Images_for_LWJGL), then you need to replace the lines similar to:

glBegin(GL_QUADS);
{
glTexCoord2f(0f,0f);
glVertex2f(0, 0);
glTexCoord2f(0f,1f);
glVertex2f(0, 100);
glTexCoord2f(1f,1f);
glVertex2f(100, 100);
glTexCoord2f(1f,0f);
glVertex2f(100, 0);
}
glEnd();

with:

glBegin(GL_QUADS);
{
glTexCoord2f(0f,0f);//This line could be changed
glVertex2f(0, 0);
glTexCoord2f(0f,2f); //This line was changed
glVertex2f(0, 100);
glTexCoord2f(2f,2f);//This line was changed
glVertex2f(100, 100);
glTexCoord2f(2f,0f);//This line was changed
glVertex2f(100, 0);
}
glEnd();
Title: Re: background and how to scale images?
Post by: dangerdoc on July 06, 2012, 18:27:43
Yeah that's what I meant. (Yay! I explained it well enough  :D)
Title: Re: background and how to scale images?
Post by: frostyfrog on July 06, 2012, 21:20:28
Off-topic:
Quote from: dangerdoc on July 06, 2012, 18:27:43
Yeah that's what I meant. (Yay! I explained it well enough  :D)
I guess we are in the same boat. With how we feel that we explained our answers.