Fast Graphics Under Windows
Covers the basics of fast graphics in Windows using either DirectDraw or CreateDIBSection().
The trick to CreateDIBSection() is that to actually get your bitmap to the screen, you have to jump through a few hoops. First you have to use CreateCompatibleDC() to create a Device Context to blit from (think of it as just a hunk of program that knows how to move pixels), SelectObject() your HBITMAP into it, then obtain the DC for your destination window, and use BitBlt() to blit from the created DC to the window's DC.
DirectDraw is pretty straight forward if all you want is a linear full screen framebuffer to manually throw pixels at (that's all I usually use, for compatability with as much hardware as possible). First buy a good book on DirectDraw. Then create a DirectDraw object, switch to Exclusive mode, change the screen mode to whatever you like, acquire the DDSurface object for the Primary surface, create an Off-Screen System Memory surface of the same size and bit depth to be your Back Buffer, then every frame Lock the Back Buffer surface, compose your graphics there in system memory, Unlock the surface, and do a DirectDraw Blit from the off-screen surface to the Primary surface. This works for a lot of things, and gives you the advantage of being able to quickly read pixels back from your back buffer (to do alpha-blending, additive-blending, burn effects, etc.), as reading pixels from a Video Memory surface is SLOW, and dangerous. To get more speed in certian styles of games, you can use Dirty Rectangle updating to only blit the changed parts of the back buffer to the visible primary surface (DX-Ball 2 uses this technique).
Check out the BackBuffer Page for some free source code that handles DirectDraw, CreateDIBSection, and even OpenGL windows!
Copyright 1998-1999 by Seumas McNally.
No reproduction may be made without the author's written consent.
Courtesy Of Longbow Digital Artists
Related Tutorials
Procedural Generation of 2D Tile Maps in Games
The article explains how to build a procedural 2D cave map generator using cellular automata. It covers map representat…
Localizing A Game Into French — Which Variant Should You Choose?
So, you’re making an awesome indie game, and now you’re thinking about localizing it into French? Great idea! There ar…
How Long Does It Take To Localize An Indie Game?
So you’re planning on localizing your indie game, but you’re not sure how much time to schedule in. While the timing o…
Creating game videos: best practices and pitfalls to avoid
Game video production: practical tips on how to create a game trailer or teaser that you can be proud of. Give your aud…
Adopting CI/CD: How Midwinter Entertainment iterates at speed with the help of IMS
Game development was once like one long sprint: a huge effort until you reached the finish line — at which point you co…
GameDev.net
5 Things to Consider When Making a Video to Promote Your App or Game
How can you show an app or game in your video in a way that attracts new users? Let’s take a look at what to go by when…
Discussion
More from Seumas McNally
Comparing Shadow Mapping Techniques with Shadow Explorer
New Incentives and a Whole New Platform From The Intel AppUp developer program
The final installment in this series on Intel's AppUp program details additional incentives and opportunities for devel…
The Game Maker
This book excerpt contains the first chapter of the book that introduces beginning game developers to the Game Maker pr…
Discussion