CeedMath & CeedGL, Let's talk 3D...
Upcoming SlideShare
Loading in...5

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



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

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



Total Views
Views on SlideShare
Embed Views



2 Embeds 8

http://us-w1.rockmelt.com 7
http://a0.twimg.com 1


Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

CeedMath & CeedGL, Let's talk 3D... CeedMath & CeedGL, Let's talk 3D... Presentation Transcript

  • CeedMath & CeedGLLet’s talk 3D...web: www.creaceed.comtwitter: @rsebbe cocoaheads.be
  • 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
  • Overview App Ceed3DGL Ceed3DRenderMan ...CeedGL Ceed3DGL CeedMath Foundation
  • CeedMath
  • 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 float & double data type
  • Definition• Written in pure C• Macro-based templates, float & double• Simple types (float*)• Chain-able• C++ interoperable (polymorphic) • In C, use _f or _d suffixes • In C++, automatic based on param type
  • Types• vector (2D, 3D, 4D)• normal (3D) / plane (4D)• matrix (2D, 4D)• quaternion (4D)• ray• box• frustum• triangle
  • What?• vector: add, subtract, dot/vect product, norm, rotate, project, find 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
  • 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>
  • 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
  • Demo
  • Demo’s
  • CeedGL
  • 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?
  • Old vs. Modern OpenGL OpenGL 1.x, 2.x OpenGL ES 1.x define camera position, define object position, choose apredefined 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
  • OpenGL• Modern OpenGL programming is hard. Especially the first 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
  • CeedGL• CeedGL does not define new concepts• But it helps in setting up and managing your OpenGL objects• Thin Objective-C Wrapper
  • CeedGL GLObjectGLFramebuffer GLRenderbuffer GLBuffer GLTexture GLShader GLProgram GLValue GLDrawCommand
  • 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
  • Draw (2/2) GLDrawCommand GLFramebufferGLProgram u GLValue GLRenderbufferv GLShader a GLValue GLTexturef GLShader a GLBuffer i GLBuffer t GLTexture
  • Demo’s
  • GLKit?• GLKit’s Math • NEON optimized • Currently iOS5 only, definitely 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
  • Happy 3D coding !web: www.creaceed.comtwitter: @rsebbe cocoaheads.be