Jump to content
  • Advertisement

Archived

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

Bill Adams

Fixed size backbuf in DX7 win mode?

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

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

Share this post


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

Share this post


Link to post
Share on other sites

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


Share this post


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

Share this post


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

Share this post


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

Share this post


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

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!