wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
Namespaces | Functions
bgi_gl.h File Reference

Internal OpenGL state management and rendering passes for the BGI library. More...

#include <GL/glew.h>
#include <glm/glm.hpp>
#include "bgi_types.h"
Include dependency graph for bgi_gl.h:

Go to the source code of this file.

Namespaces

namespace  bgi
 

Functions

void bgi::glPassDestroy ()
 Release all GL objects (call before context is destroyed).
 
void bgi::glPassInit (int w, int h)
 Initialise GL objects (shaders, VAO/VBO, page texture).
 
void bgi::glPassResetState ()
 Reset GL object handles to zero WITHOUT calling GL delete functions.
 
void bgi::glPassResize (int w, int h)
 Resize the page texture to match a new canvas size.
 
void bgi::renderPageAsTexture (int w, int h, int vpW=-1, int vpH=-1)
 Pass 1 — Upload the visual page buffer as an RGBA texture and draw a fullscreen quad.
 
void bgi::renderPageAsTextureAlpha (int w, int h, int vpW=-1, int vpH=-1)
 Overlay pass — Upload the visual page buffer as an RGBA texture and composite it ON TOP of the current framebuffer contents using alpha blending.
 
void bgi::renderPageLegacyPoints (int w, int h, int vpW=-1, int vpH=-1)
 Legacy per-pixel GL_POINTS path (kept for backward compat / diagnostics).
 
void bgi::renderSolidsGLPass (const PendingGlRender &pending, int w, int h, const LightState &light, const glm::mat4 &vp, const glm::vec3 &camPos, int vpX=0, int vpY=0)
 Pass 2a — Draw Phong-lit solid triangles (flat and/or smooth shading) with depth test.
 
void bgi::renderWireframeGLPass (const PendingGlRender &pending, int w, int h, const glm::mat4 &vp, const glm::vec3 &camPos, int vpX=0, int vpY=0)
 Pass 2b — Two-pass hidden-line wireframe with proper depth-buffer HSR.
 
void bgi::renderWorldLinesGLPass (const PendingGlRender &pending, int w, int h, const glm::mat4 &vp, int vpX=0, int vpY=0)
 Pass 3 — Draw world-space line segments with depth test (hidden behind solids).
 

Detailed Description

Internal OpenGL state management and rendering passes for the BGI library.

This module owns all GL object lifetimes (shaders, VAOs, VBOs, textures) and provides compositing passes called in order by both the GLFW standalone path (bgi_draw.cpp::flushToScreen) and the wx-embedded path (WxBgiCanvas::Render):

  1. renderPageAsTexture() — upload the 8-bit page buffer as RGBA and draw a fullscreen textured quad. Clears depth buffer. 2a. renderSolidsGLPass() — draw collected DDS solid triangles with GLSL Phong shading and GL_DEPTH_TEST enabled. 2b. renderWireframeGLPass() — two-pass hidden-line wireframe: depth-only solid fill (Pass 1) then depth-tested edge lines (Pass 2).
  2. renderWorldLinesGLPass() — draw collected world-space line segments with GL_DEPTH_TEST enabled (hidden behind solids).

Thread safety: all functions must be called with the GL context current and bgi::gMutex already held by the caller.

Legacy path: call renderPageLegacyPoints() instead of renderPageAsTexture() to reproduce the old per-pixel GL_POINTS behaviour (for diagnostic use).