3D with Max2D Functions?

BlitzMax Forums/OpenGL Module/3D with Max2D Functions?

Azan(Posted 2008) [#1]
Hello, I want to use max2d functions on top of a 3d environment. First let me just say that I am an opengl noob so bare with me. Is this viable? I know it is possible to do as I have spent the last half hour searching these forums for answers.

Sadly I have been unable to locate a definitive answer. However I did some messing around with the teapot demo that comes with blitzmax and got it to draw a rectangle on the screen using drawrect so I guess it's a start.

Any recommendations? Comments?


ImaginaryHuman(Posted 2008) [#2]
Max2D changes various `state`, for example in OpenGL, it keeps its own variables to keep track of things like the current texture, blend mode, etc. If you start sending your own OpenGL/DX commands to the card you are potentially putting the card into a state which is not tracked by Max2D and this will possibly confuse it. Not everything you do will have that effect but it's not easy to tell what is safe to do.

Otherwise before you run your custom code you need to preserve all of the `state` that Max2D is relying upon and then restore it again after you're finished. e.g. see glGet() to get state variables.


Azan(Posted 2008) [#3]
Thanks for the reply.

After trying to add a small particle engine I wrote to a 3D background I believe I found one of those video card confusions you mentioned.

Unfortunately I lack the experience in openGL to fix it so its off to learn openGL I guess.


Oddball(Posted 2008) [#4]
This is entirely possible and in fact my own 3D engine does this seemlessly. The secret is to push/pop the Max2D states to and from their relevent stacks at the right time. However if you are new to OpenGL it may be beneficial to concentrate on learning other areas first.


ImaginaryHuman(Posted 2008) [#5]
I recommend reading the entire `OpenGL Red Book` which is online.