Texture projection example for miniB3D

BlitzMax Forums/MiniB3D Module/Texture projection example for miniB3D

AdamRedwoods(Posted 2011) [#1]
Originally taken from code archives, big shout out to Fredborg for writing this. I took it and condensed it. It's not perfect, has some odd triangle problems, but works pretty well aside from that.

You could also use some other entity than the camera entity and get a fixed projection.

I used this technique to create a second texture layer (texcoords 0 or 1) which was going to be a lightmap, but couldn't fade the light texture (oh well). The advantage would've been you could run it once in the beginning and then the vertexcoords are setup, so as long as it wasn't dynamic, there's little overhead.

THEORY:
Yes, you could do this faster by using OpenGL's eye plane texture coordinate system (glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR)) , and hack it into miniB3D. Surprised this was never an option in miniB3D.

Here's the code, it's setup to take a second texture as a base layer (dl_tex2), and I've left some commented code from the original work.
NOTE: you'll need a "silly.png" image to get it to work.



Last edited 2011