Jump to content
  • Advertisement

Archived

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

devious

problems to display large bitmaps

This topic is 6017 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

Hello everybody, Has anyone encountered problems when displaying large bitmaps? I saved a large number of sprites in a single file. The file is 2560x70 (40 frames). When I display any part of this image on the screen, I am getting garbage. My source and dest rect is alright. I am using the ddutil DDLoadBitmap function. I''ve been using this code for a while without noticing any problems. When I load smaller bitmaps (10-30 frames or up to 2040 total width), everything is alright. I''m creating my surfaces in system memory. I have plenty of RAM available. Any clues? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
1. Some graphics cards don''t support surfaces which are wider than the primary surface. If the DDCAPS2_WIDESURFACES cap flag in dwCaps2 of DDCAPS isn''t set, then offscreen surfaces wider than the primary surface won''t work. (will either fail calls or simply not work in some way).

2. IIRC some cards also have a restriction on the maximum width of surfaces which the expose in the caps (it''s been quite a while since I coded any DDraw stuff though...)

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
I think that''s a pretty good hint. I''m going to check my card caps and read a bit about this stuff.

Well, I guess I''ll have to read all those sprites in different surfaces just to make sure I''m compatible.

Thanks a lot!

Share this post


Link to post
Share on other sites
rather instead keeping a 2560x70 surface try to make it square
like (assuming your sprites are 256 pixel wide)
512x350
this should work fine then on all cards and you can still keep all images in one surface which helps a lot.

With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/

Share this post


Link to post
Share on other sites
I just found that my card does support widesurfaces. Any other ideas?

MirekCZ: I'm probably going to try your idea soon since it looks like there is no other avenue! I'd really like to know why I am limited to ~2000 pixels wide surfaces.

Edited by - devious on December 26, 2001 9:42:51 PM

Share this post


Link to post
Share on other sites
devious:it might be a driver or card problem. It might be also that simple noone thought larger surfaces are needed. A popular limitation for today 3d hardware is 2048 pixels for width/height of textures. It might be the same for other stuff as those cards might "emulate" 2d by using a special case of 3d rasterization. To get good compatibility I would encourage you to keep your surfaces smaller/equal size to your primary surface.(As Simon pointed out already)

With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/

Share this post


Link to post
Share on other sites
MirekCZ ->

I hope I don''t sound too much like arguing with you guys. I''m just hoping to find the logical explanation to this problem. Right now, I don''t feel like I understand what''s going on. I''m looking forward the "AAAH YES NOW I UNDERSTAND!" feeling.

I tried different surface sizes and I have found the limit to be at 2040 pixels. 2048 didn''t work, neither did 2047. My application is opening in windowed mode. My desktop is set at 1280x1024. 1280x1024 = 1,310,720 pixels. 2560x70 = 179,200 pixels. From what I understand, my primary surface is still much wider than my offscreen surface.

That brings my next observation: I''m creating that surface in system memory. I doubt my video card drivers have anything to do with that. I''ll still update my drivers. Who knows!

Thanks for your support!

Share this post


Link to post
Share on other sites
I''ve found something interesting. Let me know if it rings a bell. If I am creating my surface NONLOCALVIDMEM, my surface will display correctly. If I create it in another way (system or local), my surface will display incorrectly.

I have upgraded my drivers to the latest version (Detonator XP). I have a TNT2 Ultra btw.

Share this post


Link to post
Share on other sites
Okay I am almost there. Here's what the SDK doc says about creating wide surfaces in localvidmem:

"... If you attempt to create a wide surface in video memory when the DDCAPS2_WIDESURFACES flag isn't present, the attempt will fail and return DDERR_INVALIDPARAMS. Note that attempting to create extremely large surfaces might still fail, even if the driver exposes the DDCAPS2_WIDESURFACES flag.

Wide surfaces are always supported for system memory surfaces, video port surfaces, and execute buffers."

"[Creating] extremely large surfaces might still fail". I love that sentence. I don't know why it doesn't work, but at least I am told it may not work as expected. My surface wasn't displayed properly because it was loaded in localvidmem (only DDSCAPS_OFFSCREENPLAIN flag was specified). When creating the surface explicitely in systemmemory or nonlocalmemory, it was displaying correctly. I'm gonna examine my options.

Oh, just for your general culture guys, I have found "extremely vertical" surfaces to be displaying correctly (like 70x2560). As a matter of fact, extremely vertical isn't extremely horizontal.

Edited by - devious on December 27, 2001 1:27:58 PM

Share this post


Link to post
Share on other sites
nonlocal vidmem is the AGP texture area, aka system memory thats mapped to the agp card memory area.

last i checked 1280 is less then 2560. 1280 is the width of your primary surface. 2560 is the width of your offscreen surface. the number of pixels has NOTHING to do with the width of surface. this seems to be the thing you are missing in your understanding. so as that was said before, reduce the width of your bitmap and make your bitmap more square.

btw, drivers/hardware have almost EVRYTHING to do with ANYTHING you do in directx. this is especially true with blits, surface creation, display mode changes, etc. drivers also affect whta you can do in windowed mode and in fullscreen mode (yes sometimes certain things dont work correctly in windowed mode).

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!