Problem Description While trying to follow along with the NVIDIA, I was not able to find a way to compile and run the files that were provided along with the, which is available for download at NVIDIA’s website. This made the tutorial difficult to follow along with. I’m aware that Cg has been discontinued by NVIDIA, but is still using it for it’s shader programming. So I wanted to learn more about Cg in order write shaders for Unity. Problem Source The source of the problem is that neither the NVIDIA nor the web describes properly how to install and setup CG toolkit so that one can compile and run CG programs using Xcode. Problem Solution In this blog, I will give a step by step description of the following:. Installing CG Toolkit on the Mac.
Finding the framework and tutorial example files installed together with CG Toolkit. Creating and setting up a Xcode project for CG programs. Compiling and running the CG Tutorial examples using Xcode. Installing CG Toolkit on Mac To install the CG Toolkit just follow this. Download the latest release.
![]()
NVIDIA CUDA Getting Started Guide for Mac OS X DU-05348-001_v6.5| 5 Chapter 3. INSTALLATION 3.1. Download Once you have verified that you have a supported NVIDIA GPU, a supported version the MAC OS, and gcc, you need to download the NVIDIA CUDA Toolkit. The NVIDIA CUDA Toolkit is available at no cost from the main CUDA Downloads page.
Once the.pkg file is downloaded, launch it and follow the instructions to run the install script. Location of Framework and Tutorial example files Once the installation is complete you will need to remember two important locations containing CG files that you will need in order to follow along with the CG tutorials (it is kind of frustrating that the download doesn’t contain any information regarding where the important files are installed). The two locations are given below for the Mac:. Location of CG Framework: /Library/Frameworks. Location of Example files to follow along with the NVIDIA CG Tutorials: /Developer/NVIDIA/Cg/examples/OpenGL/basic Creating and Setting up Xcode project.
Start Xcode and create a Command Line Tool Project. Create Xcode CG project which is going to be a Command Line Tool project. Choose C as the Language, an arbitary location with an arbitary project name. Choosing the programming language, location of the project and the project name.
![]()
Delete the main.c file from the project. Now the project should be empty. Next, select project in the Project Navigation window and choose the single available target. Go to Build Phases. Go to Build phases and add Cocao Framework and Cg Framework under Link Binary with Libraries. The Cg Framework can be found at the location provided in the section.
Add the Cg and Cocoa frameworks to the Build Phases. Next, navigate to the location of the example files (the location of the example files is provided in the section ).
I chose to import the 06vertextwisting project files because I only need to import 3 files. One file is the C OpenGL code, the other two are vertex and fragment functions written in.cg files (If you choose to import other projects, double check that you know which are all the required files). Select all the required files and drag them to the Project Navigation window of Xcode. Select the required project files and drag them to the Project Navigation window of Xcode. Once the required files have been dragged to the Xcode Project Navigation window, you will be presented with a dialog. Check the Copy items if needed checkbox and make sure that the checkbox for Add to targets is checked. Importing Files Xcode Dialog with the correct options chosen.
Once the files have been imported your Project Navigator window should look something like the screenshot below. Project Navigator WIndow after import. Now select the.c file so that the code is revealed.
Try now to build the program. The first error you will get is regarding GL/glew.h. For Mac, you need to make some changes to the code, in order to be able to compile it for Mac. The necessary changes are marked with a comment starting with CHANGE (in capital letters) in the listing below of the 06vertextwisting.c file.
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |