OpenGL 3.3 core rendering on top of SDL2. Builds on sdl2.obl for the window and context; this bundle is the GL side. Compile with -lib sdl2. Layers, thinnest first: GLWindow (window and context), GL (state), Shader, Mesh, Texture2D, Light, RenderTarget, Material, Frustum, ShadowMap, PointShadow, Overlay, Transform, and Box/Scene. All public, so nothing is capped. Targets the 3.3 core profile, forward-compatible: the highest common denominator across the desktop platforms Objeck ships, since macOS caps at 4.1 core. GLES-only hardware is out of scope by construction. See docs/opengl.md for setup, a minimal program, why the calls are coarse-grained, and how to add one.
Prop
A mesh, a material and a transform -- the thing Scene could not hold. Scene draws every Box with the ONE mesh it was given, which is what keeps a room of hundreds of boxes down to a single uploaded mesh. Anything that is a different mesh plus a transform therefore had no home, and every example that wanted one wrote the same five lines by hand: bind the texture, build the MVP, upload two matrices, draw. That sequence appears in gl_boing, 3d_gl_24, gl_model and gl_lantern. A Prop is that, as an object Scene can hold.
Why this is not Box widened
Box stays exactly what it was, and Scene keeps two lists. That is deliberate: - A Box is axis-aligned by construction, so it culls against a tight box test. A Prop has a rotation, so its mesh bounds are model-space and stop being axis-aligned the moment it turns -- it has to fall back to a bounding SPHERE, which is looser. Merging the two would have cost every wall and floor in every existing scene that accuracy. - Boxes share one mesh and one VAO. Props each bring their own, so a VAO rebind per prop is unavoidable -- but only for props. - Collision is a Box concept. OverlapsXZ is a plan-view test on a half-extent and means nothing for a rotated model, so Prop deliberately does not have it and Scene->Blocked still walks only the boxes. A prop that should block movement gets a Box beside it.
Concrete, not abstract
A class carrying a virtual method cannot be instantiated in Objeck, so an abstract Prop would need a subclass before anyone could use one. This is usable directly and can still be subclassed.
Operations
GetBoundsRadius #
Radius of a sphere that contains this prop wherever it is turned. Conservative on purpose: the mesh's own radius is measured from the mesh's CENTRE, which need not be the origin the transform rotates about, so the offset is added rather than assumed away. A bound that is slightly too large draws something that could have been culled; one that is too small makes geometry vanish at the edge of the screen.
method : public : GetBoundsRadius() ~ FloatReturn
| Type | Description |
|---|---|
| Float | the radius in world units |
GetModelMatrix #
method : public : GetModelMatrix() ~ Float[]Return
| Type | Description |
|---|---|
| Float | the model matrix; BORROWED from the transform, do not write to it |
GetTransform #
The prop's transform, to move, turn or scale it. Returned rather than copied, so changes take effect immediately.
method : public : GetTransform() ~ TransformReturn
| Type | Description |
|---|---|
| Transform | the transform |
IsOpaque #
method : public : IsOpaque() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true when this prop needs no depth sorting |