VBO vs Multitexture

BlitzMax Forums/MiniB3D Module/VBO vs Multitexture

Kryzon(Posted 2014) [#1]
Hello,
I was reading through the source of the latest official MiniB3D.
Inside the Update() method of the TMesh class, inside the FOR...NEXT loop which prepares the textures for rendering a mesh, there's a check to enable different texture units:
	If THardwareInfo.VBOSupport 'SMALLFIXES this if statement is a hack to prevent crash when vbo is not supported by GFX

		glActiveTextureARB(GL_TEXTURE0+ix)
		glClientActiveTextureARB(GL_TEXTURE0+ix)
	EndIf
	glEnable(GL_TEXTURE_2D)
	glBindTexture(GL_TEXTURE_2D,texture.gltex[frame])
	
	[...]
That "if" statement means that when the hardware does not support VBOs, it won't do multitexturing as well. But what's the relation between the hardware supporting VBOs and using more than one texture unit?
Does anyone know in which thread around here that this small-fix was discussed?

According to this article, any OpenGL implementation can safely support more than, say, 10 units, regardless of VBO usage.


Kryzon(Posted 2014) [#2]
The "smallfixes change list" from the googleCode page does not point to a thread for this particular fix.
From what I've read it's a standard practice to do multitexturing with system-memory vertex arrays (which is what MiniB3D falls back to if the hardware does not support the video-memory vertex arrays known as "VBOs").
The hardware may not support VBOs but it may still support multitexturing.

Therefore, it would make sense to change the check from VBOSupport to MultiTexSupport. The same 'if' code, but a different field being checked:
	If THardwareInfo.MultiTexSupport 'Only use multitexturing when the hardware supports it.

		glActiveTextureARB(GL_TEXTURE0+ix)
		glClientActiveTextureARB(GL_TEXTURE0+ix)
	EndIf
When the hardware does not support multi-texturing, only the last texture layer of an object will be used -- it will be uploaded to GL_TEXTURE0, which is the default unit -- and those calls inside the 'if' will always be skipped.