PDA

View Full Version : full screen intro image



{MSX}
26-01-2005, 06:34 PM
ok, i want to create an image in the game intro that occupate the whole window.
What dimension should i do it, and how can i draw it?
I want it to be shrinked when changing resolution (ie 800x600, 1024x768).
Should i do a square image or a 4/3 image? Can video cards use non-squared images?

Thanks

Paulius
26-01-2005, 07:38 PM
A textured quad in orthographic projection is all you need. There is a GL_ARB_texture_non_power_of_two extantion, but only the ultra new cards support it, so better just stick to power of two textures. Using a 4/3 image would look nicest as the image would get equally stretched in both directions.

JSoftware
26-01-2005, 09:04 PM
i have an idea of providing a functionallity in my textureloading library to load non_power_of_two textures by resizing the image automatically on load if GL_ARB_texture_non_power_of_two is not present

Sly
26-01-2005, 10:56 PM
Here is how I do it (and how we do it at work on our console games).

Create the image at the screen resolution that you want. Then resize the image to 256x256 or 512x512. Draw a single quad that fills the screen with this texture on it. Be sure to set bilinear filtering to enabled.

Another way to do it (which some other console developers use), is to create the image at the desired screen resolution. Now cut the image into 256x256 or 512x512 sections. Use these textures on 256x256 or 512x512 quads drawn on the screen.

Using either of these methods means that all your textures are power of two, resulting in maximum compatibility. That is, these methods work on every 3D card out there.

I hope that makes sense.

{MSX}
27-01-2005, 07:52 AM
Create the image at the screen resolution that you want. Then resize the image to 256x256 or 512x512. Draw a single quad that fills the screen with this texture on it. Be sure to set bilinear filtering to enabled.

Thanks! i think i'll do this way.
Btw, how and where do i set bilinear filtering ? :P

JSoftware
27-01-2005, 09:24 AM
i do it this way:


glGenTextures(1, tmp);
glBindTexture(GL_TEXTURE_2D, tmp);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if mode = bilinear then
begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if mipmap then
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_linear)
else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
end
else
begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_nearest);
if mipmap then
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_nearest_MIPMAP_NEAREST)
else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_nearest);
end;
if mipmap then
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, pData)
else
lTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pData);


this is ofcourse a shortened down version without all the disturbing comments and commented code..

Paulius
27-01-2005, 09:35 AM
JSoftware youre bilinear is actually trilinear.
Bilinear without mipmaps
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Bilinear with mipmaps
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
Trilinear
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

JSoftware
27-01-2005, 10:05 AM
no not if mipmap is false and mode is set to bilinear