Upcoming SlideShare
×

# CeedMath & CeedGL, Let's talk 3D...

1,440 views

Published on

Presentation of the CeedMath & CeedGL open source libraries for easier computer graphics programming on Mac & iOS

Published in: Technology, Art & Photos
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,440
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
6
0
Likes
2
Embeds 0
No embeds

No notes for slide

### CeedMath & CeedGL, Let's talk 3D...

2. 2. Overview• CeedMath & CeedGL are libraries for easier computer graphics development on Mac & iOS• BSD license• Available on Github • https://github.com/rsebbe/CeedMath • https://github.com/rsebbe/CeedGL
3. 3. Overview App Ceed3DGL Ceed3DRenderMan ...CeedGL Ceed3DGL CeedMath Foundation
4. 4. CeedMath
5. 5. Why?• CG math libs are generally written in C++• C++ is cumbersome when developing in Objective-C• Need of a pure C library• Need for both ﬂoat & double data type
6. 6. Deﬁnition• Written in pure C• Macro-based templates, ﬂoat & double• Simple types (ﬂoat*)• Chain-able• C++ interoperable (polymorphic) • In C, use _f or _d sufﬁxes • In C++, automatic based on param type
7. 7. Types• vector (2D, 3D, 4D)• normal (3D) / plane (4D)• matrix (2D, 4D)• quaternion (4D)• ray• box• frustum• triangle
8. 8. What?• vector: add, subtract, dot/vect product, norm, rotate, project, ﬁnd angles, lerp...• matrix: add, subtract, multiply, transform, solve, invert...• quaternion: standard operations...• ray: intersections w/ plane/triangle/box...• box: union / intersection...• frustum: perspective transform...• triangle: normal computation
9. 9. Xcode Project• Universal: Mac & iOS libs• Headers note • lib: PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/CeedMath • app: HEADER_SEARCH_PATHS = "\$(DSTROOT)/usr/local/include" "\$ (CONFIGURATION_BUILD_DIR)/usr/local/include" • #include <CeedMath/C3Math.h>
10. 10. Demo• Demo #1: template mechanics• Demo #2: real world example (rounded rect) C3MeshGeometry+Primitives.mm• Demo #3: C++ templates for mouse picking C3StreamPrimitive+Picking.mm
11. 11. Demo
12. 12. Demo’s
13. 13. CeedGL
14. 14. Why?• OpenGL is a C API, most GL objects are int’s • Error prone, all function take int’s • Complex APIs, many functions • Not practical within Objective-C • Intimidating, hard to start• Higher level abstractions exist (scene graphs), but what if you only need standard OpenGL?
15. 15. Old vs. Modern OpenGL OpenGL 1.x, 2.x OpenGL ES 1.x deﬁne camera position, deﬁne object position, choose apredeﬁned illumination model, place the lights, draw some triangles, change position, draw some other... OpenGL >= 3.1 OpenGL ES 2.x + WebGLset vertices, indices, shading program & params, then draw
16. 16. OpenGL• Modern OpenGL programming is hard. Especially the ﬁrst time... • It’s a functional C API • Most “objects” are represented by handles (int) • Modern GL has removed many concepts • Light, shading, transforms • For the good, the old pipeline was limiting, and a hurdle for card makers • It is now more in sync w/ hardware capabilities
17. 17. CeedGL• CeedGL does not deﬁne new concepts• But it helps in setting up and managing your OpenGL objects• Thin Objective-C Wrapper
18. 18. CeedGL GLObjectGLFramebuffer GLRenderbuffer GLBuffer GLTexture GLShader GLProgram GLValue GLDrawCommand
19. 19. Draw (1/2) • Vertex Shader • 1 execution per vertex • inputs: uniform, attribute • output: varying • Fragment Shader • 1 execution per output pixel • input: uniform, varying • output: fragment color
20. 20. Draw (2/2) GLDrawCommand GLFramebufferGLProgram u GLValue GLRenderbufferv GLShader a GLValue GLTexturef GLShader a GLBuffer i GLBuffer t GLTexture
21. 21. Demo’s
22. 22. GLKit?• GLKit’s Math • NEON optimized • Currently iOS5 only, deﬁnitely Apple only • Has an overlap with CeedMath• GLKit’s GL • Forces a GL coding style • Provides easier starting point • Mostly complementary to CeedGL• Permissive, forkable open source make sense in such projects