Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

sc0rpy

Background.. how?

This topic is 6965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
yeah, i just used the opengl superbible code, and i loaded up a 640x480 bitmap on a surface....

a2k

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!