Skip to content

GLVAO & State Cleanup#976

Draft
RuffledPlume wants to merge 17 commits into117HD:masterfrom
RuffledPlume:GLVAO
Draft

GLVAO & State Cleanup#976
RuffledPlume wants to merge 17 commits into117HD:masterfrom
RuffledPlume:GLVAO

Conversation

@RuffledPlume
Copy link
Contributor

@RuffledPlume RuffledPlume commented Mar 1, 2026

Still WIP and has issues, but is booting & drawing so progress

The aim of this PR is to ensure that the state is tracked at all times, this way we can avoid dangling OpenGL state in between drawing & frames, leading to had to track bugs

Example Vertex Layout Declaration:

	public static final GLVertexLayout ZONE_VERTEX_LAYOUT = new GLVertexLayout("ZONE_VERTEX_LAYOUT")
		// Mesh Data
		.edit(ArrayField.VERTEX_FIELD_0).enabled().component(ComponentType.RGB).format(FormatType.SHORT).stride(VERT_SIZE).offset(0)
		.edit(ArrayField.VERTEX_FIELD_1).enabled().component(ComponentType.RGB).format(FormatType.HALF_FLOAT).stride(VERT_SIZE).offset(6)
		.edit(ArrayField.VERTEX_FIELD_2).enabled().component(ComponentType.RGB).format(FormatType.SHORT).stride(VERT_SIZE).offset(12)
		.edit(ArrayField.VERTEX_FIELD_3).enabled().component(ComponentType.R).format(FormatType.INT).stride(VERT_SIZE).offset(20).asInteger()
		// Meta Data
		.edit(ArrayField.VERTEX_FIELD_6).enabled().component(ComponentType.R).format(FormatType.INT).stride(METADATA_SIZE).offset(0).asInteger().divisor(1)
		.edit(ArrayField.VERTEX_FIELD_7).enabled().component(ComponentType.RG).format(FormatType.INT).stride(METADATA_SIZE).offset(4).asInteger().divisor(1)
		.finish();

Example GLVAO Declaration:

if ((vboA = a) != null) {
	alphaVao = new GLVao("Zone::Alpha::VAO", ZONE_VERTEX_LAYOUT);
	alphaVao.associateBufferRange(vboA, ArrayField.VERTEX_FIELD_0, ArrayField.VERTEX_FIELD_3);
	alphaVao.associateBufferRange(vboM, ArrayField.VERTEX_FIELD_6, ArrayField.VERTEX_FIELD_7);
	alphaVao.associateBuffer(eboAlpha, ArrayField.ELEMENT_BUFFER);
}

@RuffledPlume RuffledPlume reopened this Mar 1, 2026
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.

2 participants