Fixed size backbuf in DX7 win mode?

Started by
6 comments, last by Bill Adams 23 years, 11 months ago
Has anyone implemented a fixed size back buffer in windows mode? The docs say to size it based on the primary surface, but I''d like keep it fixed - It would simplify switching to and from exclusive mode, and ease some direct home brew back buf blits (say that fast ten times!). The back-to-primary Blt seems to accomodate different sizes with RECT parameters, but I''m getting undocumented CreateDevice errors. Just a "I''ve done it" is enough - If I see zero replies, I''ll assume it can''t be done - Thanks
Advertisement
You should be able to create an offscreen buffer, use that as your render target and then blit from that one to your framebuffer. Since in windowed mode you make a blit from backbuffer to framebuffer anyway you shouldn''t see much of a slowdown, if any at all.

- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game


In windowed mode, you dont have exlusive access to the primary surface so cant use an attached backbuffer to the primary surface. You will, as the previous post said, need to create an offscreen buffer and blit that one to the primarysurface.

This is exactly what i''m doing in my gfx-library.
Follow these steps :
1. Create a primarysurface
2. Create an offscreen plainsurface with the desired format.
3. Attach a DDClipper to the primarysurface.

When blitting, you will have to set up a RECT structure holding your window''s screen koordinates (GetClientRect(), ClientToScreen() etc) and use it as the destination-rect parameter in blt like :
primarySurface->blt(&destRect,&offscreenSurface,NULL,...

Hope this helped, It some time since I coded this, but i pretty sure this was how I did that

Cheers!
/ Tooon


Exactly what Tooon said.

The only way to do a flipping chain in windowed mode is by using overlays. Overlays are hardware dependant (not emulated) so if you want to support them you will have to support the above method as well.


nathany.com
Thanks Guys...
I finally got it working in win mode, but I bit the bullet and went for the variable sized backbuffer (actually an offscreen surface as noted above). Apparently there was a conflict with bits-per-pixel which caused CreateDevice(...) to choke, which I solved temporarily by setting the screen to 800x600x16. (it was 24 bpp). This is only an 3D object viewer to develop the "engine" but it does looks real good in a window!

BTW: Does the term overlay simply refer to the blitting of multiple surfaces to another, or is there something more formal? I need to do some more reading I guess...
Actually overlay surfaces are completely separated from the primary buffer, they can even have different pixelformats. The graphic card doesn''t combine the surfaces into one image until it is ready to send it to the monitor, which is why overlays can''t be emulated in software. The main usage of overlay surfaces today are in video applications, so the video can be smoothly animated independantly of other graphics.

- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

The pleasures of Windowed mode. If you want to use it, you should technically support 15/16/24/32-bit color depths. Fun, fun, fun

nathany.com
Yeh, I know, Its on my list of things to do. This is a learning project though, and I can always disable windows mode in a release version.

This topic is closed to new replies.

Advertisement