Initializes the complete 3D graphics subsystem with DirectX 12, physics, and rendering pipeline.
Takes resWidth (horizontal resolution), resHeight (vertical resolution), graphicsMode (1=windowed+vsync, 2=fullscreen+no vsync, 3=windowed+no vsync, 4=hidden canvas-only).
Returns TRUE (1) on success, FALSE (0) on failure.
3D Graphics
Parameters & Returns
Parameters
resWidthInt
resHeightInt
graphicsModeInt
Returns
Int
Quick Summary
Initializes the complete 3D graphics subsystem with DirectX 12, physics, and rendering pipeline.
Takes resWidth (horizontal resolution), resHeight (vertical resolution), graphicsMode (1=windowed+vsync, 2=fullscreen+no vsync, 3=windowed+no vsync, 4=hidden canvas-only).
Returns TRUE (1) on success, FALSE (0) on failure.
Technical Exegesis...
Initializes the complete 3D graphics subsystem with DirectX 12, physics, and rendering pipeline. Takes resWidth (horizontal resolution), resHeight (vertical resolution), graphicsMode (1=windowed+vsync, 2=fullscreen+no vsync, 3=windowed+no vsync, 4=hidden canvas-only). Returns TRUE (1) on success, FALSE (0) on failure. Must be called once before any 3D rendering. Call b3dSetMSAA and b3dShowConsoleOutput BEFORE this function.
Initializes the complete 3D graphics subsystem with DirectX 12, physics, and rendering pipeline. Takes resWidth (horizontal resolution), resHeight (vertical resolution), graphicsMode (1=windowed+vsync, 2=fullscreen+no vsync, 3=windowed+no vsync, 4=hidden canvas-only). Returns TRUE (1) on success, FALSE (0) on failure. Must be called once before any 3D rendering. Call b3dSetMSAA and b3dShowConsoleOutput BEFORE this function. Initialization sequence: (1) Display splash screen during load, (2) Initialize network subsystem, (3) Create DirectX 12 device and command queues, (4) Create main window or hide if mode 4, (5) Create swap chain with FLIP_DISCARD and frame latency waitable object, (6) Allocate depth buffer (DXGI_FORMAT_D32_FLOAT) with MSAA if configured, (7) Initialize 3D entity system and mesh resource manager, (8) Initialize Jolt Physics engine with default gravity, (9) Initialize terrain system, (10) Initialize 2D overlay system for UI rendering. Window created with WS_OVERLAPPEDWINDOW style (resizable). Mode 4 (hidden) creates window off-screen for canvas-only rendering. VSYNC in mode 1 caps to monitor refresh. No VSYNC in modes 2/3 for unlimited FPS. Fullscreen mode 2 uses exclusive fullscreen if available. Returns FALSE if: DirectX 12 not supported, GPU not found, insufficient VRAM, window creation fails, swap chain creation fails. Check g_showConsoleOutput for detailed error messages.
This is the master initialization function - massive ~200 line implementation. Creates g_3D_pDevice (separate from BGI's g_pDevice), g_3D_pCommandQueue, g_3D_pSwapChain. Uses CommandListManager pattern from MiniEngine for command list recycling. Frame latency waitable object enables frame pacing without busy-wait. Depth buffer matches render target resolution * MSAA. Triple buffering (FRAME_BUFFER_COUNT = 3) for smooth frame pacing. Physics uses Jolt (not PhysX) - modern constraint-based solver. Terrain system supports heightmaps, LOD, splatmaps. 2D overlay renders text/sprites over 3D scene. Initialization time: 1-3 seconds depending on mesh count, longer first run (shader compilation). Mode 4 use case: tool applications with multiple canvas viewports, no main window. DXGI factory enables adapter enumeration. Creates root signatures for standard shaders. Allocates descriptor heaps (CBV_SRV_UAV, RTV, DSV). Compiles/loads default shaders. Initializes constant buffers for camera/lighting. Sets default camera position/orientation. Essential for any 3D application - equivalent to Direct3D initialization but simplified to single function call.