3D OpenGL Engine

BlitzPlus Forums/BlitzPlus Programming/3D OpenGL Engine

Todd, it sounds like what you are saying is that GL will just cast the shadows for us, and we don't have to calculate projection and stuff? That's definitely worth trying! The latest version I posted uses actual light entities. The light position can be gotten by EntityX,Y,Z(). The light range can be gotten by GetLightRange(), and the colors by LightRed(), LightGreen()...

To cycle through entities to find lights, use this loop:
For n=0 to BankSize(DEIMOS_ENTITY_LIST)-1 Step 8
entity=PeekInt(DEIMOS_ENTITY_LIST,n)
If EntityClass(entity)=3
Endif
Next


You might add a flag parameter to the entity flags to specify a shadow caster:
Const DEIMOS_ENTITY_FLAG_CASTSSHADOWS=2


To specify an entity to cast shadows use this:
PokeInt entity,DEIMOS_ENTITY_FLAGS,2^DEIMOS_ENTITY_FLAG_CASTSSHADOWS


To see if an entity casts shadows use this:
If EntityFlag(entity,DEIMOS_ENTITY_FLAG_CASTSSHADOWS)
Endif


Sooner or later I think we will need a DLL written to access GL extensions:
http://blitzbasic.com/Community/posts.php?topic=28532