forked from sachithkadamba/CocoaSampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Darcy Liu
committed
Feb 25, 2013
1 parent
fa22ed4
commit 01f415f
Showing
28 changed files
with
4,829 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
719 changes: 719 additions & 0 deletions
719
GLSLBasicsCocoaDL/English.lproj/MainMenu.nib/designable.nib
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
336 changes: 336 additions & 0 deletions
336
GLSLBasicsCocoaDL/GLSLBasicsCocoaDL.xcodeproj/project.pbxproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,336 @@ | ||
// !$*UTF8*$! | ||
{ | ||
archiveVersion = 1; | ||
classes = { | ||
}; | ||
objectVersion = 44; | ||
objects = { | ||
|
||
/* Begin PBXBuildFile section */ | ||
36B67AAF0E3657D600695250 /* TranguloidTrefoilGeometry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 36B67AA30E3657D500695250 /* TranguloidTrefoilGeometry.mm */; }; | ||
36B67AB00E3657D600695250 /* GLUTString.m in Sources */ = {isa = PBXBuildFile; fileRef = 36B67AA60E3657D500695250 /* GLUTString.m */; }; | ||
36B67AB10E3657D600695250 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 36B67AA80E3657D500695250 /* main.m */; }; | ||
36B67AB20E3657D600695250 /* Plasma.fs in Resources */ = {isa = PBXBuildFile; fileRef = 36B67AAA0E3657D600695250 /* Plasma.fs */; }; | ||
36B67AB30E3657D600695250 /* Plasma.vs in Resources */ = {isa = PBXBuildFile; fileRef = 36B67AAB0E3657D600695250 /* Plasma.vs */; }; | ||
36B67AB40E3657D600695250 /* GLSLBasicsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 36B67AAE0E3657D600695250 /* GLSLBasicsView.m */; }; | ||
36B67AD80E36590900695250 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36B67AD70E36590900695250 /* GLUT.framework */; }; | ||
36B67AFA0E365D1900695250 /* Shader.m in Sources */ = {isa = PBXBuildFile; fileRef = 36B67AF90E365D1900695250 /* Shader.m */; }; | ||
36C820A60E3FDB4E00049C5E /* GLSLHardwareSupport.c in Sources */ = {isa = PBXBuildFile; fileRef = 36C820A40E3FDB4E00049C5E /* GLSLHardwareSupport.c */; }; | ||
74E028770B819B0400B15674 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74E028760B819B0400B15674 /* OpenGL.framework */; }; | ||
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; | ||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; | ||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; | ||
/* End PBXBuildFile section */ | ||
|
||
/* Begin PBXFileReference section */ | ||
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; | ||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; | ||
29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; }; | ||
360B79C20C3D8C350085BCCF /* info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = info.plist; sourceTree = "<group>"; }; | ||
36B67AA20E3657D500695250 /* TranguloidTrefoilGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranguloidTrefoilGeometry.h; sourceTree = "<group>"; }; | ||
36B67AA30E3657D500695250 /* TranguloidTrefoilGeometry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TranguloidTrefoilGeometry.mm; sourceTree = "<group>"; }; | ||
36B67AA50E3657D500695250 /* GLUTString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLUTString.h; sourceTree = "<group>"; }; | ||
36B67AA60E3657D500695250 /* GLUTString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLUTString.m; sourceTree = "<group>"; }; | ||
36B67AA80E3657D500695250 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | ||
36B67AAA0E3657D600695250 /* Plasma.fs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Plasma.fs; sourceTree = "<group>"; }; | ||
36B67AAB0E3657D600695250 /* Plasma.vs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Plasma.vs; sourceTree = "<group>"; }; | ||
36B67AAD0E3657D600695250 /* GLSLBasicsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSLBasicsView.h; sourceTree = "<group>"; }; | ||
36B67AAE0E3657D600695250 /* GLSLBasicsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLSLBasicsView.m; sourceTree = "<group>"; }; | ||
36B67AD70E36590900695250 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = /System/Library/Frameworks/GLUT.framework; sourceTree = "<absolute>"; }; | ||
36B67AF80E365D1900695250 /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shader.h; sourceTree = "<group>"; }; | ||
36B67AF90E365D1900695250 /* Shader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Shader.m; sourceTree = "<group>"; }; | ||
36C820A40E3FDB4E00049C5E /* GLSLHardwareSupport.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = GLSLHardwareSupport.c; sourceTree = "<group>"; }; | ||
36C820A50E3FDB4E00049C5E /* GLSLHardwareSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSLHardwareSupport.h; sourceTree = "<group>"; }; | ||
74E028760B819B0400B15674 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; | ||
8D1107320486CEB800E47090 /* GLSLBasicsCocoaDL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GLSLBasicsCocoaDL.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
/* End PBXFileReference section */ | ||
|
||
/* Begin PBXFrameworksBuildPhase section */ | ||
8D11072E0486CEB800E47090 /* Frameworks */ = { | ||
isa = PBXFrameworksBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, | ||
74E028770B819B0400B15674 /* OpenGL.framework in Frameworks */, | ||
36B67AD80E36590900695250 /* GLUT.framework in Frameworks */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXFrameworksBuildPhase section */ | ||
|
||
/* Begin PBXGroup section */ | ||
19C28FACFE9D520D11CA2CBB /* Products */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
8D1107320486CEB800E47090 /* GLSLBasicsCocoaDL.app */, | ||
); | ||
name = Products; | ||
sourceTree = "<group>"; | ||
}; | ||
29B97314FDCFA39411CA2CEA /* SimpleFBO */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AA00E3657D500695250 /* Sources */, | ||
29B97317FDCFA39411CA2CEA /* Resources */, | ||
29B97323FDCFA39411CA2CEA /* Frameworks */, | ||
19C28FACFE9D520D11CA2CBB /* Products */, | ||
); | ||
name = SimpleFBO; | ||
sourceTree = "<group>"; | ||
}; | ||
29B97317FDCFA39411CA2CEA /* Resources */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
360B79C20C3D8C350085BCCF /* info.plist */, | ||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, | ||
29B97318FDCFA39411CA2CEA /* MainMenu.nib */, | ||
); | ||
name = Resources; | ||
sourceTree = "<group>"; | ||
}; | ||
29B97323FDCFA39411CA2CEA /* Frameworks */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, | ||
36B67AD70E36590900695250 /* GLUT.framework */, | ||
74E028760B819B0400B15674 /* OpenGL.framework */, | ||
); | ||
name = Frameworks; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AA00E3657D500695250 /* Sources */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AA10E3657D500695250 /* Geometry */, | ||
36B67AA40E3657D500695250 /* GLUT */, | ||
36C820A30E3FDB4E00049C5E /* Hardware */, | ||
36B67AA70E3657D500695250 /* Other */, | ||
36B67AA90E3657D500695250 /* Plasma */, | ||
36B67AF70E365D1900695250 /* Shader */, | ||
36B67AAC0E3657D600695250 /* View */, | ||
); | ||
path = Sources; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AA10E3657D500695250 /* Geometry */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AA20E3657D500695250 /* TranguloidTrefoilGeometry.h */, | ||
36B67AA30E3657D500695250 /* TranguloidTrefoilGeometry.mm */, | ||
); | ||
path = Geometry; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AA40E3657D500695250 /* GLUT */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AA50E3657D500695250 /* GLUTString.h */, | ||
36B67AA60E3657D500695250 /* GLUTString.m */, | ||
); | ||
path = GLUT; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AA70E3657D500695250 /* Other */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AA80E3657D500695250 /* main.m */, | ||
); | ||
path = Other; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AA90E3657D500695250 /* Plasma */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AAA0E3657D600695250 /* Plasma.fs */, | ||
36B67AAB0E3657D600695250 /* Plasma.vs */, | ||
); | ||
path = Plasma; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AAC0E3657D600695250 /* View */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AAD0E3657D600695250 /* GLSLBasicsView.h */, | ||
36B67AAE0E3657D600695250 /* GLSLBasicsView.m */, | ||
); | ||
path = View; | ||
sourceTree = "<group>"; | ||
}; | ||
36B67AF70E365D1900695250 /* Shader */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36B67AF80E365D1900695250 /* Shader.h */, | ||
36B67AF90E365D1900695250 /* Shader.m */, | ||
); | ||
path = Shader; | ||
sourceTree = "<group>"; | ||
}; | ||
36C820A30E3FDB4E00049C5E /* Hardware */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
36C820A40E3FDB4E00049C5E /* GLSLHardwareSupport.c */, | ||
36C820A50E3FDB4E00049C5E /* GLSLHardwareSupport.h */, | ||
); | ||
path = Hardware; | ||
sourceTree = "<group>"; | ||
}; | ||
/* End PBXGroup section */ | ||
|
||
/* Begin PBXNativeTarget section */ | ||
8D1107260486CEB800E47090 /* GLSL Basics Cocoa */ = { | ||
isa = PBXNativeTarget; | ||
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GLSL Basics Cocoa" */; | ||
buildPhases = ( | ||
8D1107290486CEB800E47090 /* Resources */, | ||
8D11072C0486CEB800E47090 /* Sources */, | ||
8D11072E0486CEB800E47090 /* Frameworks */, | ||
); | ||
buildRules = ( | ||
); | ||
dependencies = ( | ||
); | ||
name = "GLSL Basics Cocoa"; | ||
productInstallPath = "$(HOME)/Applications"; | ||
productName = SimpleFBO; | ||
productReference = 8D1107320486CEB800E47090 /* GLSLBasicsCocoaDL.app */; | ||
productType = "com.apple.product-type.application"; | ||
}; | ||
/* End PBXNativeTarget section */ | ||
|
||
/* Begin PBXProject section */ | ||
29B97313FDCFA39411CA2CEA /* Project object */ = { | ||
isa = PBXProject; | ||
attributes = { | ||
BuildIndependentTargetsInParallel = YES; | ||
}; | ||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GLSLBasicsCocoaDL" */; | ||
compatibilityVersion = "Xcode 3.0"; | ||
hasScannedForEncodings = 1; | ||
mainGroup = 29B97314FDCFA39411CA2CEA /* SimpleFBO */; | ||
projectDirPath = ""; | ||
projectRoot = ""; | ||
targets = ( | ||
8D1107260486CEB800E47090 /* GLSL Basics Cocoa */, | ||
); | ||
}; | ||
/* End PBXProject section */ | ||
|
||
/* Begin PBXResourcesBuildPhase section */ | ||
8D1107290486CEB800E47090 /* Resources */ = { | ||
isa = PBXResourcesBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, | ||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, | ||
36B67AB20E3657D600695250 /* Plasma.fs in Resources */, | ||
36B67AB30E3657D600695250 /* Plasma.vs in Resources */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXResourcesBuildPhase section */ | ||
|
||
/* Begin PBXSourcesBuildPhase section */ | ||
8D11072C0486CEB800E47090 /* Sources */ = { | ||
isa = PBXSourcesBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
36B67AAF0E3657D600695250 /* TranguloidTrefoilGeometry.mm in Sources */, | ||
36B67AB00E3657D600695250 /* GLUTString.m in Sources */, | ||
36B67AB10E3657D600695250 /* main.m in Sources */, | ||
36B67AB40E3657D600695250 /* GLSLBasicsView.m in Sources */, | ||
36B67AFA0E365D1900695250 /* Shader.m in Sources */, | ||
36C820A60E3FDB4E00049C5E /* GLSLHardwareSupport.c in Sources */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXSourcesBuildPhase section */ | ||
|
||
/* Begin PBXVariantGroup section */ | ||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { | ||
isa = PBXVariantGroup; | ||
children = ( | ||
089C165DFE840E0CC02AAC07 /* English */, | ||
); | ||
name = InfoPlist.strings; | ||
sourceTree = "<group>"; | ||
}; | ||
29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { | ||
isa = PBXVariantGroup; | ||
children = ( | ||
29B97319FDCFA39411CA2CEA /* English */, | ||
); | ||
name = MainMenu.nib; | ||
sourceTree = "<group>"; | ||
}; | ||
/* End PBXVariantGroup section */ | ||
|
||
/* Begin XCBuildConfiguration section */ | ||
C01FCF4B08A954540054247B /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
INFOPLIST_FILE = info.plist; | ||
PRODUCT_NAME = GLSLBasicsCocoaDL; | ||
}; | ||
name = Debug; | ||
}; | ||
C01FCF4C08A954540054247B /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; | ||
ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64"; | ||
INFOPLIST_FILE = info.plist; | ||
PRODUCT_NAME = GLSLBasicsCocoaDL; | ||
}; | ||
name = Release; | ||
}; | ||
C01FCF4F08A954540054247B /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
GCC_PRECOMPILE_PREFIX_HEADER = NO; | ||
GCC_WARN_ABOUT_RETURN_TYPE = YES; | ||
GCC_WARN_UNUSED_VARIABLE = YES; | ||
PREBINDING = NO; | ||
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; | ||
}; | ||
name = Debug; | ||
}; | ||
C01FCF5008A954540054247B /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ARCHS = ( | ||
ppc, | ||
i386, | ||
); | ||
GCC_PRECOMPILE_PREFIX_HEADER = NO; | ||
GCC_WARN_ABOUT_RETURN_TYPE = YES; | ||
GCC_WARN_UNUSED_VARIABLE = YES; | ||
PREBINDING = NO; | ||
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; | ||
}; | ||
name = Release; | ||
}; | ||
/* End XCBuildConfiguration section */ | ||
|
||
/* Begin XCConfigurationList section */ | ||
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "GLSL Basics Cocoa" */ = { | ||
isa = XCConfigurationList; | ||
buildConfigurations = ( | ||
C01FCF4B08A954540054247B /* Debug */, | ||
C01FCF4C08A954540054247B /* Release */, | ||
); | ||
defaultConfigurationIsVisible = 0; | ||
defaultConfigurationName = Release; | ||
}; | ||
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "GLSLBasicsCocoaDL" */ = { | ||
isa = XCConfigurationList; | ||
buildConfigurations = ( | ||
C01FCF4F08A954540054247B /* Debug */, | ||
C01FCF5008A954540054247B /* Release */, | ||
); | ||
defaultConfigurationIsVisible = 0; | ||
defaultConfigurationName = Release; | ||
}; | ||
/* End XCConfigurationList section */ | ||
}; | ||
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Introduction: | ||
|
||
This sample code demonstrates how to load, compile, and link GLSL fragment and vertex shaders from within a simple Cocoa application. | ||
|
||
The Fragment and vertex shaders have c like syntax and reside in the files with ".vs" and ".fs" extensions respectively, inside the main application bundle. They're loaded, compiled, linked and bound to a program object using OpenGL APIs and instantiated through the Shader class. The shader class here does not validate the program object. | ||
|
||
This project further contains a simple class for displaying strings in an OpenGL view using GLUT's built-in bitmap fonts. | ||
|
||
This application further demonstrates a simple timer based OpenGL animation from within a Cocoa application. | ||
|
||
It is also worth noting that the Tranguloid Trefoil geometry here is a parametric surface, created using a display list. | ||
|
||
Mouse support: | ||
|
||
� For zooming the object, hold the right-mouse down and move mouse up or down. | ||
� For updating the pitch, hold the left-mouse key down and change the angle. | ||
|
||
Revision History: | ||
|
||
� Refactored the sample code to better demonstrate the interaction of OpenGL APIs with an OpenGL view. | ||
� Moved the GLSL program object instantiation into its own basic class. | ||
� Moved the GLSL hardware check code into its a separate file. | ||
� Consistent use of float math library functions for pattern and palette generation. | ||
� Animation continues during window resizing. | ||
� Consistent use of doubles and their OpenGL equivalents during geometry generation. | ||
� Updated the Xcode project to use the new format. | ||
� Updated the NIB to use the new format. | ||
� Added a simple GLUT string class. |
Oops, something went wrong.