Seeking advice about flow of code and data placement

Tried converting my existing code to follow a diagram on learnopengl.com but it became a mess so I started again only to realise that it uses a bunch of unexplained types in the code examples it gave so now I’m just ignoring most of it and only trying to copy the flow of the diagram. I got as far as the link file’s contents, my question is this, where should I put the vertex attribute array IDs and buffer element array IDs and related data, and is there any data that I have missed that I should put in? Right now I just want to follow the flow enough to get a triangle “mesh” to appear on screen, then I’ll work on adding texture & any other transformative stuff that belongs there to the “mesh” before moving onto objects that require multiple meshes. Hopefully by that point I won’t need to pester people here anymore.

Edit: Whoops forgot the link
https://drive.google.com/file/d/1rYhQJJuO8qquggpel42oFMcfTBG5PpTg/view?usp=sharing

Edit 2: Scrap advice on the vertex attribute array, finally understood what the hell that was, just the variables in the crafters/shaders prior to the main() function, got some code in for that now so now I just need advice on the index array stuff, should those be used along side the vertex attribute array or in place of?

Just in case I did misunderstand something this is how I’m treating the VertexArrays & VertexAttribArrays

void bind_detail_to_buffer( AREA *area, INDEX detailIndex, INDEX bufferIndex )
{
	INDEX lowestDetailTotal, lowestBufferTotal;
	LIST *DetailIDs, *Details, *BufferIDs, *Buffers;
	uint *detailIDs, *detailID, *bufferIDs, *bufferID;
	DETAIL *details, *detail;
	BUFFER *buffers, *buffer;

	if ( !area )
		return;

	DetailIDs = &(area->DetailIDs);
	Details = &(area->Details);
	detailIDs = DetailIDs->addr;
	detailID = detailIDs + detailIndex;
	details = Details->addr;
	lowestDetailTotal = least_of( DetailIDs, Details );

	BufferIDs = &(area->BufferIDs);
	Buffers = &(area->Buffers);
	bufferIDs = BufferIDs->addr;
	bufferID = bufferIDs + bufferIndex;
	buffers = Buffers->addr;
	lowestBufferTotal = least_of( BufferIDs, Buffers );

	if ( detailIndex >= lowestDetailTotal || bufferIndex >= lowestBufferTotal )
		return;

	// detailID is a result of glGenVertexArrays
	// detail->place is a result of glGetAttribLocation

	glBindVertexArray( *detailID );
	glEnableVertexAttribArray( detail->place );
	glBindBuffer( buffer->type, *bufferID );
	glVertexAttribPointer
	(
		detail->place
		, detail->have
		, detail->type
		, detail->normalised
		, buffer->buff.perN
		, (void*)(detail->offset)
	);
}

Decided the guides weren’t working for me so I went looking for an open source project to learn from, the first one I settled on is called “tinyrenderer”, was in C++ so I’m converting to ANSI C so it’s easier to see what is actually happening, currently converting the TGA image code, I’ll come back to my experiments after understanding how the flow is supposed to work.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.