RE: Designing a renderer
"Garett Bass" <[email protected]> Tue, 1 Jul 2003 12:38:51 -0500
| Newsgroups | gmane.games.devel.design |
|---|---|
| Message-ID | <[email protected]> |
Dirk wrote: > E.g: Let's say we have a base class IRenderer which is > implemented by two derived class COGLRendererImpl and > CDXRendererImpl. Both derived classes implement a virtual > function IRenderer::Init(...). The arguments vary with > the OS. On a Windows platform you have to pass the HWND > for the window, on a Linux system that could be totally > different. I don't know how others handle this, but I have a windowing system abstraction layer that hides all the platform specifics such as window handles and such, and just lets me create, size, move windows. One subclass of the window class is a 3D context window, which can be sized and moved, and can be initialized with a specific pixel format. This should be Linux friendly since the platform implementation details are hidden. I don't expose any private variables in the class header, instead I handle all of the platform specifics within the .cpp files using maps to associate data with the interface classes as needed. In Win32 there is very little that must be stored aside from the hwnd and hdc, just about everything else can be queried from the Win32 API. I don't know enough about Direct3D to design for it, but OpenGL makes this easy because my 3D context window can handle all wgl* specifics like MakeCurrent and SwapBuffers, and otherwise I can just call OpenGL functions anywhere in my code and the current context receives them automagically. YMMV, Garett Bass [email protected] ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Gamedevlists-design mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-design Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=556