Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Shows how to draw a 3D object without using shaders

NotificationsYou must be signed in to change notification settings

hollance/Swift-3D-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple demo app for macOS that shows how to draw a 3D object without using shaders. It illustrates what happens behind the scenes when you use OpenGL or Metal to do 3D drawing.

Want to know how it works? Check outRender.swift. It has lots of explanations.

Alsoread the accompanying blog post. It has pretty pictures!

The app doesn't use any 3D or math APIs: everything you see is done by the logic in theRender.swift source file. The only API used for drawing is asetPixel() function that writes a pixel RGBA value to a bitmap. The math used does not involve matrices, so you can see exactly what happens when and why.

Because this is only intended for educational purposes, there is some stuff that doesn't work super great:

  • Triangles are not clipped against the field of view of the camera. This isn't really an issue, unless the z-position of camera comes too close to the vertices, in which case triangles may be drawn incorrectly (upside down or not at all).
  • It is quite slow. But of course that's why you'd use a GPU for real 3D work.

About

Shows how to draw a 3D object without using shaders

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp