Permalink
Browse files

imported

  • Loading branch information...
0 parents commit f329a535b75acf6495c80197c24bc7ea0cabbd4d @rsebbe rsebbe committed Jan 3, 2012
Showing with 8,884 additions and 0 deletions.
  1. +1,060 −0 CeedGL.xcodeproj/project.pbxproj
  2. +6 −0 CeedGL.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  3. +28 −0 LICENSE
  4. +30 −0 Mac/CeedGL-Info.plist
  5. +22 −0 Mac/CeedGLDemo-Info.plist
  6. +32 −0 Mac/CeedGLDemo/CeedGLDemo-Info.plist
  7. +7 −0 Mac/CeedGLDemo/CeedGLDemo_Prefix.pch
  8. +19 −0 Mac/CeedGLDemo/Classes/CeedGLDemoAppDelegate.h
  9. +25 −0 Mac/CeedGLDemo/Classes/CeedGLDemoAppDelegate.m
  10. +18 −0 Mac/CeedGLDemo/Classes/CeedGLDemoView.h
  11. +137 −0 Mac/CeedGLDemo/Classes/CeedGLDemoView.m
  12. +29 −0 Mac/CeedGLDemo/en.lproj/Credits.rtf
  13. +3 −0 Mac/CeedGLDemo/en.lproj/InfoPlist.strings
  14. +3,707 −0 Mac/CeedGLDemo/en.lproj/MainMenu.xib
  15. +13 −0 Mac/CeedGLDemo/main.m
  16. +11 −0 Mac/CeedGL_Prefix.pch
  17. +114 −0 README.md
  18. +12 −0 Sources/CeedGL.h
  19. +35 −0 Sources/GLBuffer.h
  20. +97 −0 Sources/GLBuffer.m
  21. +17 −0 Sources/GLBufferDataSource.h
  22. +53 −0 Sources/GLDebug.h
  23. +14 −0 Sources/GLDebug.m
  24. +58 −0 Sources/GLDrawCommand.h
  25. +218 −0 Sources/GLDrawCommand.m
  26. +32 −0 Sources/GLFramebuffer.h
  27. +138 −0 Sources/GLFramebuffer.m
  28. +26 −0 Sources/GLObject.h
  29. +42 −0 Sources/GLObject.m
  30. +8 −0 Sources/GLPlatform.h
  31. +45 −0 Sources/GLProgram.h
  32. +254 −0 Sources/GLProgram.m
  33. +24 −0 Sources/GLRenderbuffer.h
  34. +70 −0 Sources/GLRenderbuffer.m
  35. +33 −0 Sources/GLShader.h
  36. +114 −0 Sources/GLShader.m
  37. +35 −0 Sources/GLTexture.h
  38. +102 −0 Sources/GLTexture.m
  39. +69 −0 Sources/GLValue.h
  40. +358 −0 Sources/GLValue.m
  41. +32 −0 iOS/CeedGLDemo/CeedGLDemo-Info.plist
  42. +389 −0 iOS/CeedGLDemo/CeedGLDemoViewController.xib
  43. +14 −0 iOS/CeedGLDemo/CeedGLDemo_Prefix.pch
  44. +22 −0 iOS/CeedGLDemo/Classes/CeedGLDemoAppDelegate.h
  45. +56 −0 iOS/CeedGLDemo/Classes/CeedGLDemoAppDelegate.m
  46. +38 −0 iOS/CeedGLDemo/Classes/CeedGLDemoViewController.h
  47. +485 −0 iOS/CeedGLDemo/Classes/CeedGLDemoViewController.m
  48. +37 −0 iOS/CeedGLDemo/Classes/EAGLView.h
  49. +153 −0 iOS/CeedGLDemo/Classes/EAGLView.m
  50. +485 −0 iOS/CeedGLDemo/MainWindow.xib
  51. +14 −0 iOS/CeedGLDemo/Shaders/Shader.fsh
  52. +22 −0 iOS/CeedGLDemo/Shaders/Shader.vsh
  53. +17 −0 iOS/CeedGLDemo/main.m
  54. +5 −0 iOS/CeedGL_Prefix.pch

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
28 LICENSE
@@ -0,0 +1,28 @@
+CeedGL is provided under the following license (3-clause BSD License):
+
+Copyright (c) 2010, Creaceed SPRL
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Creaceed SPRL nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL CREACEED SPRL BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The "CeedGL" name and icon are Copyright © 2010 Creaceed SPRL
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+
+ <key>CFBundleIdentifier</key>
+ <string>com.creaceed.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
+
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.creaceed.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>${MACOSX_DEPLOYMENT_TARGET}</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'CeedGLDemo' target in the 'CeedGLDemo' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
@@ -0,0 +1,19 @@
+//
+// CeedGLDemoAppDelegate.h
+// CeedGLDemo
+//
+// Created by Raphael Sebbe on 06/11/10.
+// Copyright (c) 2010 Creaceed. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface CeedGLDemoAppDelegate : NSObject <NSApplicationDelegate> {
+ NSWindow *window;
+
+ IBOutlet NSOpenGLView *glView;
+}
+
+@property (retain) IBOutlet NSWindow *window;
+
+@end
@@ -0,0 +1,25 @@
+//
+// CeedGLDemoAppDelegate.m
+// CeedGLDemo
+//
+// Created by Raphael Sebbe on 06/11/10.
+// Copyright (c) 2010 Creaceed. All rights reserved.
+//
+
+#import "CeedGLDemoAppDelegate.h"
+
+@implementation CeedGLDemoAppDelegate
+
+@synthesize window;
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+ // Insert code here to initialize your application
+}
+
+- (void)dealloc {
+
+ [window release];
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,18 @@
+//
+// CeedGLDemoView.h
+// CeedGL
+//
+// Created by Raphael Sebbe on 06/11/10.
+// Copyright (c) 2010 Creaceed. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import <CeedGL/CeedGL.h>
+
+@interface CeedGLDemoView : NSOpenGLView {
+ GLProgram *program;
+ GLDrawCommand *command;
+
+}
+
+@end
@@ -0,0 +1,137 @@
+//
+// CeedGLDemoView.m
+// CeedGL
+//
+// Created by Raphael Sebbe on 06/11/10.
+// Copyright (c) 2010 Creaceed. All rights reserved.
+//
+
+#import "CeedGLDemoView.h"
+#import <OpenGL/gl.h>
+#import <CeedGL/CeedGL.h>
+
+#define STRINGIFY(A) [NSString stringWithCString:#A encoding:NSUTF8StringEncoding]
+
+@implementation CeedGLDemoView
+
+- (void)dealloc {
+ // Clean-up code here.
+
+ [super dealloc];
+}
+
+- (void)prepareOpenGL
+{
+ GLLogMethod();
+
+ NSString *vertexShaderSource =
+ STRINGIFY(
+ attribute vec4 a_position;
+ attribute vec4 a_source_color;
+ varying vec4 v_destination_color;
+ uniform mat4 u_projection_matrix;
+ uniform mat4 u_modelview_matrix;
+
+ void main(void)
+ {
+ v_destination_color = a_source_color;
+ gl_Position = u_projection_matrix * u_modelview_matrix * a_position;
+ }
+ );
+ NSString *fragmentShaderSource =
+ STRINGIFY(
+ varying vec4 v_destination_color;
+ void main(void)
+ {
+ gl_FragColor = v_destination_color;
+ }
+ );
+
+ program = [[GLProgram program] retain];
+
+ NSError *error = nil;
+ GLShader *vshader = [GLShader vertexShader], *fshader = [GLShader fragmentShader];
+
+ [vshader setSource:vertexShaderSource];
+ if(![vshader compile:&error]) { NSLog(@"Vertex shader compilation error: %@", error); }
+
+ [fshader setSource:fragmentShaderSource];
+ if(![fshader compile:&error]) { NSLog(@"Fragment shader compilation error: %@", error); }
+
+ [program attachShader:vshader];
+ [program attachShader:fshader];
+ [program bindAttributeLocation:0 forName:@"a_position"];
+
+ if(![program link:&error]) { NSLog(@"Could not link program error: %@", error); }
+
+
+ command = [[GLDrawCommand drawCommand] retain];
+ command.program = program;
+ command.mode = GL_TRIANGLES;
+ command.firstElement = 0;
+ command.elementCount = 3;
+
+ GLBuffer *attr = [GLBuffer buffer];
+ GLfloat pos[] = {0,0, 0.5,0, 0.5,1};
+ [attr loadData:pos size:sizeof(pos) usage:GL_STATIC_DRAW target:GL_ARRAY_BUFFER];
+ [command setAttributeBuffer:attr size:2 type:GL_FLOAT normalized:GL_FALSE stride:0 offset:0 forName:@"a_position"];
+
+// GLBuffer *colattr = [GLBuffer buffer];
+// GLfloat col[12] = {0,0,0,1, 1,0,0,1, 0.5, 1,0,1};
+// [colattr loadData:col size:sizeof(col) usage:GL_STATIC_DRAW target:GL_ARRAY_BUFFER];
+// [command setAttributeBuffer:colattr size:4 type:GL_FLOAT normalized:GL_FALSE stride:0 offset:0 forName:@"a_source_color"];
+ [command setAttribute:[GLValue vectorWithFloats:1 :0 :0 :1] forName:@"a_source_color"];
+
+// GLBuffer *indices = [GLBuffer buffer];
+// GLushort inds[3] = {0,1,2};
+// [indices loadData:inds size:sizeof(inds) usage:GL_STATIC_DRAW target:GL_ELEMENT_ARRAY_BUFFER];
+// [command setElementIndexes:indices type:GL_UNSIGNED_SHORT];
+
+
+ GLfloat modelView[] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
+ GLfloat projection[] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
+
+ [command setUniform:[GLValue matrixWithFloats:modelView size:4] forName:@"u_modelview_matrix"];
+ [command setUniform:[GLValue matrixWithFloats:projection size:4] forName:@"u_projection_matrix"];
+
+
+ glClearColor(0.1, 0.3, 0.5, 1);
+}
+
+- (void)reshape
+{
+ GLLogMethod();
+
+ [[self openGLContext] makeCurrentContext];
+
+ glViewport(0, 0, [self bounds].size.width, [self bounds].size.height);
+
+}
+
+- (void)drawRect:(NSRect)rect
+{
+ GLLogMethod();
+ [[self openGLContext] makeCurrentContext];
+
+ //glClearColor(0.5, 0.3, 0.5, 1);
+
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ //glMatrixMode(GL_MODELVIEW);
+ //glLoadIdentity();
+ //glOrtho(0, 1, 0, 1, -1, 1);
+ [command draw];
+
+// glBegin(GL_TRIANGLES);
+// glVertex2f(0,0);
+// glVertex2f(0.5,0);
+// glVertex2f(0.5, 1);
+// glEnd();
+
+ glSwapAPPLE();
+}
+
+
+
+@end
@@ -0,0 +1,29 @@
+{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\paperw9840\paperh8400
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f0\b\fs24 \cf0 Engineering:
+\b0 \
+ Some people\
+\
+
+\b Human Interface Design:
+\b0 \
+ Some other people\
+\
+
+\b Testing:
+\b0 \
+ Hopefully not nobody\
+\
+
+\b Documentation:
+\b0 \
+ Whoever\
+\
+
+\b With special thanks to:
+\b0 \
+ Mom\
+}
@@ -0,0 +1,3 @@
+/* Localized versions of Info.plist keys */
+
+NSHumanReadableCopyright = "© Creaceed, 2010";
Oops, something went wrong.

0 comments on commit f329a53

Please sign in to comment.