Advertisement

Background.. how?

Started by April 14, 2000 03:13 PM
28 comments, last by sc0rpy 24 years, 6 months ago
Want a quick fix for loading odd shaped textures? load them with MIPMAP filtering! It uses more memory, but it''s the easiest solution, that way you don''t have to break it up or resize it oddly.

Morgan
The keyword is filtering, I would prefer if no filtering was applied. It''s hard to ask a graphics artist to spend time making a nice background then explain to them why it looks like sh*t because it was filtered.

It''s not a big deal, there are always ways to draw a large background. I''m just surprised it''s so difficult to do it without massive FPS loss / image quality loss.
This Space Left Blank
Advertisement
sc0rpy...to get the maximum texture size the current driver supports:

GLint maxTextureSize;

glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);


To reduce any filtering problems, when uploading the texture that you are going to display as a flat 2D graphic, make sure you switch filtering to nearest:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);


Edited by - gmcbay on 4/24/00 1:51:44 AM
I''ve made, this weekend, a texture-based bitmap loader which works with bitmaps of any size. It still needs to be tested, though, so I won''t comment until it *really* is usable (works fine on my machine, but freezes my friend''s).

Eric Laberge
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4
Well you create a MIPMAP using gluBuild2DMipmaps() instead of glTexImage2D(). The filtering is up to you, pick the one you want, it doesn''t matter. But, mipmap is the only way I know of to load textures of unmatching side lengths.

Morgan
yeah, i just used the opengl superbible code, and i loaded up a 640x480 bitmap on a surface....

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
To be honest I never tried mipmaps for the larger images, I suppose in my haste the ''filtering'' word caught my eye and so I avoided the topic.
I know what DemonLord is doing and it was what I was planning on doing except I got caught converting my .3ds code from d3d to ogl so I didn''t have much time to experiment with this topic further.

Obviously the topic is of interest to others explaining why this thread is getting so long.
This Space Left Blank
After some testing, my irregularly-shaped bitmap loader seems to be visually perfect. So far, it has been tested with bitmaps whose dimensions were multiples of four [252x60, by example], though I don''t see any reason why it wouldn''t work on anything else. It has been tested with 8-bit and 24-bit bitmaps, on 16 and 32 bit displays. I have to notice that framerate jumped to fill-rate limitation (140+FPS @1024x768x32) from about 10 FPS, so it is obviously performing great.

I still have some memory problem (hence my question on the board), so I''ll wait until it is finished and stable to post some code. Here how it basically works:

1) Decode the bitmap
2) Split the bitmap to optimize the memory usage.
3) Create textures
4) Create a display list and return the display list number

Examples of bitmap separations:
Bitmap size : 120x320
Texture sizes: 128x128
Number of textures: 1x3 (3)

Bitmap size : 640x480
Texture sizes: 256x256
Number of textures: 3x2 (6)

I will post, if anybody''s interrested.

Eric Laberge
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4
Sure, post it if you have time.

If you have webspace somewhere maybe post the EXE aswell so we can see it in action.. otherwise an overview of the code would be excellent.

This Space Left Blank
I''ll post next week-end or so (exams... lot of work).

Eric Laberge
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4

This topic is closed to new replies.

Advertisement