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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MarkSill
Prole
Posts: 13
Joined: Fri Mar 14, 2014 9:14 am
Location: The Web of Interconnectivity
Contact:

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

Post by MarkSill » Fri Apr 20, 2018 4:56 pm

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?
Last edited by MarkSill on Mon Apr 23, 2018 1:41 am, edited 1 time in total.
Heyo, I'm MarkSill. I'm a programmer, and I like chips with salsa.

MarkSill
Prole
Posts: 13
Joined: Fri Mar 14, 2014 9:14 am
Location: The Web of Interconnectivity
Contact:

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

Post by MarkSill » Sun Apr 22, 2018 9:40 pm

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 1107 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
Attachments
test.love
(151.95 KiB) Downloaded 36 times
Heyo, I'm MarkSill. I'm a programmer, and I like chips with salsa.

MarkSill
Prole
Posts: 13
Joined: Fri Mar 14, 2014 9:14 am
Location: The Web of Interconnectivity
Contact:

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

Post by MarkSill » Mon Apr 23, 2018 1:40 am

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 1086 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....)
Attachments
test.love
(286.37 KiB) Downloaded 26 times
Heyo, I'm MarkSill. I'm a programmer, and I like chips with salsa.

User avatar
pgimeno
Party member
Posts: 1943
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

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

Post by pgimeno » 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

MarkSill
Prole
Posts: 13
Joined: Fri Mar 14, 2014 9:14 am
Location: The Web of Interconnectivity
Contact:

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

Post by MarkSill » Mon Apr 23, 2018 6:29 pm

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.
Heyo, I'm MarkSill. I'm a programmer, and I like chips with salsa.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests