Re: [AD] 3d transformations |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thu, 26 Jul 2012 19:35:44 +0200
Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
>
> With this and the new VBO functions SiegeLord added and combined with
> the shaders addon A5 actually is capable of doing full 3D rendering
> independent of OpenGL/DirectX. We kinda "abuse" the fact that the
> rendering of all polygons is done by shaders... and the primitives
> addon I believe now is capable of storing full 3d models together with
> their vertex attributes on the GPU :)
Committed it along with documentation and an example, since I may need
it for TINS on the weekend :)
I also documented the undocumented projection functions. My
understanding is that ever since Trent added those Allegro had two
transformations:
1) The regular, per-target-bitmap 2D transformation which is changed
with al_use_transform. It applies to all drawing operations to a
target bitmap, including drawing to a memory bitmap. It can be changed
while drawing is held.
2) The new projection transformation, which is per display. It is
therefore completely ignored when drawing to memory bitmaps (there is
no display involved) and it also cannot be changed while drawing is
held.
Just from an API view it would be more logical to only have a single
transform, there's nothing inherently preventing the same kinds of
transformations. However it causes several problems with 3D
transformations, e.g. projected positions would need to store 4
components instead of 3 when storing them for held drawing.
So, I think I kinda like the current way. It also gives justification
to why it doesn't work on memory bitmaps, in a way.
The only problem with it right now is that changing a target bitmap
seems to reset the projection, at least on some platforms. We'll
have to figure out how we want to handle that. The best way may be to
simply amend the documentation to say that al_set_target_bitmap will
always reset the projection.
Any functions internally changing the target bitmap (like the font
drawing) will then be required to store and restore the
projection (they don't do that right now I believe).