Page 1 of 1

How would I go about drawing simple 3D shapes in 11.0? [Solved!]

Posted: Fri Apr 20, 2018 4:56 pm
by MarkSill
11.0 adds a bunch of new features to be used from shaders for supporting depth buffers, but I don't have any clue how I'd actually use them. Are there any examples out there or something to get me started?

Re: How would I go about drawing simple 3D shapes in 11.0?

Posted: Sun Apr 22, 2018 9:40 pm
by MarkSill
I've been working on trying to get it to work, and I've been making progress. I've been trying to adapt the love3d demos' code to work in my environment.

Doing the calculations outside of the shader code seems to suggest that it should be drawing something, but it's not.
Screenshot from 2018-04-22 14-33-52.png
Screenshot from 2018-04-22 14-33-52.png (29.13 KiB) Viewed 4635 times
(The drawn lines are drawn outside of the shader. Note the Z coordinates of the vertices, which seem to be much larger/smaller than they should be.)

GitHub repo containing my test code: https://github.com/MarkSill/love-3d-test

Re: How would I go about drawing simple 3D shapes in 11.0?

Posted: Mon Apr 23, 2018 1:40 am
by MarkSill
After fiddling with my matrix function, I got it to work! I'm not sure what the issue was, but now I've got a 3D triangle.

Also, turns out my calculations seem to have their Y coordinate flipped.
Screenshot from 2018-04-22 18-37-54.png
Screenshot from 2018-04-22 18-37-54.png (27.06 KiB) Viewed 4614 times
If you want to see how it works, you can visit the GitHub repo: https://github.com/MarkSill/love-3d-test

(Also, sorry for the triple post. I forgot the edit feature was a thing until after I'd already posted....)

Re: How would I go about drawing simple 3D shapes in 11.0? [Solved!]

Posted: Mon Apr 23, 2018 9:28 am
by pgimeno
There are two problems you may have run into; one is https://github.com/excessive/cpml/issues/33 and the other is viewtopic.php?p=219678#p219678

Re: How would I go about drawing simple 3D shapes in 11.0? [Solved!]

Posted: Mon Apr 23, 2018 6:29 pm
by MarkSill
pgimeno wrote: Mon Apr 23, 2018 9:28 am There are two problems you may have run into; one is https://github.com/excessive/cpml/issues/33 and the other is viewtopic.php?p=219678#p219678
Yeah, I did run into that. The makeProper function reorders the matrix.