Simple quad program?

BlitzMax Forums/BlitzMax OpenGL Programming/Simple quad program?

skidracer: I do agree with you there (however many times I tried to twist it around as a 'bad thing' in my book, it doesn't work), and thus if (probably worth it to continue reading, 'cause that's a big 'if' there) I decide to continue using Max2D I'll just modify it and expose the functions. Or not use Max2D. Which would probably be easier in the long run as then I wouldn't have to deal with its peculiar nuances.

Dreamora: It's not intended for anything beyond simple 2D application. Look at the source, it's obvious that they weren't thinking ahead when designing Max2D and Max3D as Max3D is going to have -another- device class which will then make the Max2D driver utterly useless to have. So what I think is neccessary is that if Blitz Research are going to use hardware acceleration primarily in their 2D system is to write a device class that has 2D and 3D functionality (general functionality, not full blown engine type but rather like the Direct3D Device class, it has DrawPrimitives, states, and such that can be modified via methods) and then Max2D and Max3D should be written to use this device class instead of depending on their own seperate device (or drivers as Mark calls them) classes.

The aforementioned device class proposed would obviously require writing new math classes which -- assuming Mark wouldn't go insane -- would be there for users to use and abuse the device class(es) with.

On another note (I say that way too much), I've been thinking about deleting Brl's Max2D and GLMax2D modules (and any others that depend on them) just because they aren't worth the trouble and then rewriting it in my own way that isn't as ack basswards and instead mimics a full 2D and 3D device class (similar to the Managed DirectX Direct3D Device class, in a sense). Actually, I've already done the device class, it's still a work in progress though..

Type CDevice Abstract
	Field Indices:Int[]
	Field Vertices:CVertex[]
	
	Field Material:CMaterial
	
	Field Width:Int,Height:Int
	
	Method ClearColor(R#,G#,B#,A#) Abstract
	Method SetViewport(X%,Y%,Width%,Height%) Abstract
	Method GetViewport(X:Int Ptr, Y:Int Ptr, _Width:Int Ptr, _Height:Int Ptr) Abstract
	
	Method DrawPrimitives(PrimitiveType:Int) Abstract
	Method SetVertexData(Indices:Int[],Vertices:CVertex[]) Abstract

	Method Clear(Enum:Int = CBuffers.Color | CBuffers.Depth) Abstract
	Method Present() Abstract
	
	Method SetWorldMatrix(mat:CMatrix) Abstract
	Method SetViewMatrix(mat:CMatrix) Abstract
	Method SetProjectionMatrix(mat:CMatrix) Abstract
	
	Method GetWorldMatrix:CMatrix() Abstract
	Method GetViewMatrix:CMatrix() Abstract
	Method GetProjectionMatrix:CMatrix() Abstract
	
	Method FreeObjectResources(i:Object) Abstract
	Method LoadObjectResources(i:Object) Abstract
	
	Method LoadVertexShader:CVertexShader(path$) Abstract
	Method LoadPixelShader:CPixelShader(path$) Abstract
	
	Method BindShader(i:CShader) Abstract
	Method BindTexture(i:CTexture) Abstract
	
	' Get this.. CEngine_Global_Device is.. PUBLIC!  Oh, my god, Becky.
	
	Method SetActiveDevice()
		CEngine_Global_Device = Self
	End Method
	
	Function GetActiveDevice:CDevice()
		Return CEngine_Global_Device
	End Function
End Type


At the moment, I have that working with OpenGL and I'm working on a software renderer for it now (wrapped SDL's 2D functions and such into a nice neat package so no hardware acceleration is required -- yes folks, I added 'real 2D', it's actually faster than normal Blitz2D/Plus stuff too).