??? Direct Draw Does'nt Support Surfaces Wider than 1000 pixels?

Started by
5 comments, last by stevenmarky 23 years, 10 months ago
I want to make a scrolling picture background on my game (Direct X7 800*600 * 16bit color), but each time I try and run my program with a surface that has a bitmap wider than 1000 pixels it does''nt work, it just shuts down. Has anyone else had this problem? //end
Advertisement
Hi

The Problem can''t be DirectDraw, cause i can create Surfaces larger then 1000 Pixels. For example when using 1024 Resolution, or 2048x2048 Textures.
To get more detailed Information, you should check the return Codes of functions. So that you know where the Error happens.
It could be while creating the Surface, while Locking or maybe when you are Blitting.

One Problem could be the Resolution itself, some of the Graphic Cards require Surfaces in Resolutions, that are dividible by an specific Factor 8, 16, 32 when they are in Video Memory.
Just for some Testing, you can put your Surface in System Memory, maybe it is a Problem with not enough Memory.

Lars
--------> http://www.larswolter.de <---------
I don''t know if it''s a Direct Draw limitation or a Video Card one but, correct me if I''m wrong, I think you must pass textures with width and height that are a power of 2. Like 2, 4, 8, 16, 32, 64, 128...

Darkening
---------------------------Unfortunately, no one can be told what a bug is.You have to see it for yourself...
Ahh I had written a nice answer when all of a sudden Iexplorer had to hang.

Anyway, First of all to Darkening stevenmarky never mentioned the word texture but I know you assume things sometimes so I will answer your question first.
Whether a texture has to be of a power of two is determined by the device running the app. It also determines if the texture has to be square. You get that information by calling the GetCaps method.

Now to stevenmarkys question.
First of all I need to know if you are trying to make the primary surface 1000 pixels wide, because that is not possible. In fact you can''t set the size of the primary (and secondary if you are in exclusive mode) surface at all because that is handled by DirectDraw. The primary surface has to have the same size as the resolution if you are in fullscreen mode.

If it is not the primary surface you can''t set the size of but any offscreen surface then it should work (most of the times) to set it''s size to wider than the resolution. However this is again determined by the DirectDraw driver. Check the GetCaps method to see it it can handle wide surfaces.
You can make several "pages".
The way it would work is this.

You have 10 pages(a full screen) of image data.
Every frame you update the current window position(window is a screen size window of what is currently viewable).
Then you calculate which two pages that window is made up of and blt the correct parts.

It actually runs very fast because it only involves an integer divide to find out which pages are visible. And some modulus to find out which regions of those pages are visible.

This also works well for extremely long levels which can be streamed from disk.

You could keep a buffer of say 5 pages in memory and when the window moves farther along in the set of pages, just flush out the old pages and preload new ones.



MCSE, MCSD, Sun Certified Java Programmer
Pimp Daddy ;)
MCSE, MCSD, Sun Certified Java ProgrammerPimp Daddy ;)
Yes i had this problem...

Its TRUE u cant make a VIDEO surface greater *wider the a little over current x resolution...

i kind think its a DirectX 3.0 problem so i dont know for sure if its also a directx 7.0 because i still dont need more then directx 3.0

now u have 3 solutions:
1.make ur surfaces in SYSTEM ram
2.make more high then width...
3.Change to DirectX 7.0

Hope this helps...

Bogdan
obysoft
It is NOT a DirectX problem.
The ability to create surfaces (in VideoMemory) is dependant totally on the video card. My ATI card supports as large a texture that will fit, however, my neomagic card supports surfaces the size of the primary and smaller.

Textures that need to be square or 2^x by 2_y is also a video card issue.

You can create surfaces as large as you want in system memory (limited by memory and the maximum DWORD value) as far as I know.
___________________________Freeware development:ruinedsoft.com

This topic is closed to new replies.

Advertisement