Skip to content

Add GLFrameBuffer & GLTexture to reduce boilerplate#716

Closed
RuffledPlume wants to merge 13 commits into117HD:masterfrom
RuffledPlume:FrameBuffer_Texture_Class
Closed

Add GLFrameBuffer & GLTexture to reduce boilerplate#716
RuffledPlume wants to merge 13 commits into117HD:masterfrom
RuffledPlume:FrameBuffer_Texture_Class

Conversation

@RuffledPlume
Copy link
Copy Markdown
Contributor

@RuffledPlume RuffledPlume commented Sep 17, 2025

Aims to reduce boilerplate and simplify the process of working with glFrameBuffer & glTexture.

Example declarations:

sceneFBO = new GLFrameBuffer(new GLFrameBufferDesc()
					.setWidth(canvas.getWidth())
					.setHeight(canvas.getHeight())
					.setMSAASamples(msaaSamples)
					.setColorAttachment(GLAttachmentSlot.COLOR0, backbufferFormat, GLTextureParams.DEFAULT())
					.setDepthAttachment(GLTextureFormat.DEPTH32F, GLTextureParams.DEFAULT()));
shadowMapFBO = new GLFrameBuffer(
					new GLFrameBufferDesc()
						.setWidth(shadowFBOSize)
						.setHeight(shadowFBOSize)
						.setDepthAttachment(GLTextureFormat.DEPTH32F,
							new GLTextureParams()
								.setSampler(GLSamplerMode.NEAREST_CLAMP)
								.setTextureUnit(TEXTURE_UNIT_SHADOW_MAP)
								.setBorderColor(new float[] { 1.0f, 1.0f, 1.0f, 1.0f})));
tileHeightMapTex = new GLTexture(EXTENDED_SCENE_SIZE, EXTENDED_SCENE_SIZE, MAX_Z, GLTextureFormat.R16I, new GLTextureParams()
					.setType(GLTextureType.TEXTURE3D)
					.setSampler(GLSamplerMode.NEAREST_CLAMP)
					.setTextureUnit(TEXTURE_UNIT_TILE_HEIGHT_MAP));
int anisotropySamples = config.anisotropicFilteringLevel();
texMaterialTextureArray = new GLTexture(textureSize, textureSize, textureLayers.size(), GLTextureFormat.SRGB8_ALPHA8,
				GLTextureParams.DEFAULT()
					.setType(GLTextureType.TEXTURE2D_ARRAY)
					.setTextureUnit(TEXTURE_UNIT_GAME)
					.setGenerateMipmaps(anisotropySamples > 0)
					.setAnisotropySamples(anisotropySamples)
					.setImmutable(true)
					.setDebugName("Material Textures Array"));

…wrapped

Added support for MSAA Resolving before bliting
Added TextureFormat & Attachment slot helper functions
Added Texture3D To TextureType Enum
 * Assigned Labels to FrameBuffers & Attachments
 * Assigned Labels to GLTextures

Improved Binding by introducing rudimentary GLRenderState cache
Fixed issue with glBind overriding the Active TextureUnit, GL_Texture0 should now be bound at all times, except when assositating a FrameBuffer attachment/GLTexture with a specific TextureUnit

ClearColor/ClearDepth made to take parameters for the clear values
@RuffledPlume RuffledPlume marked this pull request as ready for review September 18, 2025 15:15
@RuffledPlume
Copy link
Copy Markdown
Contributor Author

RuffledPlume commented Sep 18, 2025

Now in a working state.
Tested toggling plugin & AsyncInterfaceCopy with no issues.

Improved RenderDoc Debugging:
image

image image

Improved resize to avoid recreating the whole FBO
Refactored backBufferFBO Name
Fixed TiledLighting by adding Unsigned support
Cleanup

GLTexture needs to resize the PixelBuffer too

Added Texture Immutable & MipMap Support

Refactored the Materials Texture Array to use GLTexture
@RuffledPlume RuffledPlume force-pushed the FrameBuffer_Texture_Class branch from 1e18b61 to 62fe0d2 Compare October 5, 2025 06:43
@RuffledPlume RuffledPlume marked this pull request as draft February 23, 2026 14:09
@RuffledPlume
Copy link
Copy Markdown
Contributor Author

Closing in favor of: 1034 since this branch is extremely out of date, as it was before the ZoneRenderer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant