background and how to scale images?

Started by mutsop, June 30, 2012, 13:13:51

Previous topic - Next topic

mutsop

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

dangerdoc

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!
“We build but to tear down. Most of our work and resource is squandered. Our onward march is marked by devastation. Everywhere there is an appalling loss of time, effort and life. A cheerless view, but true.” - Nikola Tesla

mutsop

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 :)

frostyfrog

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, 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();

dangerdoc

Yeah that's what I meant. (Yay! I explained it well enough  :D)
“We build but to tear down. Most of our work and resource is squandered. Our onward march is marked by devastation. Everywhere there is an appalling loss of time, effort and life. A cheerless view, but true.” - Nikola Tesla

frostyfrog

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.