Initializing the SBgl context and creating a native window.
Initializing the Context
SBgl uses an explicit context for all operations.
return 0;
}
API for the SiputBiru Graphics Library (SBgl).
sbgl_InitResult sbgl_Init(int w, int h, const char *title)
Initializes the engine and opens a window.
void sbgl_Shutdown(sbgl_Context *ctx)
Gracefully shuts down the engine and releases all resources.
Result structure for initialization.
Initialization with Configuration
For applications requiring custom resource limits or validation settings, use sbgl_InitWithConfig():
.windowWidth = 1920,
.windowHeight = 1080,
.windowTitle = "Application",
.limits = {
.maxBuffers = 4096,
.maxShaders = 512,
.maxPipelines = 1024
},
.enableValidation = true
};
sbgl_InitResult sbgl_InitWithConfig(const sbgl_InitConfig *config)
Initializes the engine and opens a window with explicit configuration.
Configuration for engine initialization.
Using Default Configuration
The sbgl_DefaultInitConfig macro provides sensible defaults that can be selectively overridden:
#define sbgl_DefaultInitConfig
Default initialization configuration values.
sbgl_ResourceLimits limits
Default Resource Limits
When using sbgl_Init() or sbgl_DefaultInitConfig, the following defaults apply:
| Resource | Default | Minimum |
| Buffers | 1024 | 64 |
| Shaders | 256 | 16 |
| Pipelines | 256 | 16 |
Limits below the minimum are automatically clamped to ensure stability.
The Main Loop
}
bool sbgl_WindowShouldClose(sbgl_Context *ctx)
Checks if the user or OS has requested to close the window.
void sbgl_EndDrawing(sbgl_Context *ctx)
Finalizes the current frame and presents it to the screen.
void sbgl_BeginDrawing(sbgl_Context *ctx)
Prepares the engine for a new frame of drawing.