Git Product home page Git Product logo

cgra350_project's Introduction

CGRA OpenGL Base Project

Requirements

The project requires CMake to build before compiling. The recommended way to build to project is to create a build folder then using CMake to create to project inside it. Make sure that you are creating the build folder in the same directory as the work folder.

$ mkdir build

This project also requires OpenGL v3.3 and a suitable C++11 compiler.

Linux

Command Line

The simpliest way to set up a basic project is to run the shell script runcmake.sh (runcmake.bat for Windows) which runs the cmake, make and run commands for you.

$ ./runcmake.sh

Alternativiely you can run the commands manually.

$ cd build
$ cmake ../work
$ make
$ cd ..

If the project builds without errors the executable should be located in the build/bin/ directory and can be run with:

$ ./build/bin/base [args...]

Eclipse

Setting up for Eclipse is a little more complicated. Navigate to the build folder and run cmake for Eclipse.

$ cd build
$ cmake  -G "Eclipse  CDT4 - Unix  Makefiles" ../work

Start Eclipse and go to File > Import > Existing Projects into Workspace, browse to and select the build/ directory as the project. Make sure the box Copy Projects into Workspace is unchecked. Once you've imported the project, and are unable run it, do the following:

  • Go to Run > Run Configurations. On the left side, select C/C++ Application, then in the Main tab, make sure your C/C++ Application field contains ./bin/base and that Enable auto build is checked.
  • On your project, [right click] > Run As > C/C++ Application. This should setup the default way to start the program, so you can simply run the project anytime after that.

If you need to run with arguments (and you will with some projects) go to Run > Run Configurations > Arguments and enter your arguments there. For example: ./work/res/assets/teapot.obj

Windows

Visual Studio

This project requires at least Visual Studio 2017. You can get the latest, Visual Studio Community 2017, for free from Microsoft.

Product XX
Visual Studio 2017 15

Run the cmake command for Visual Studio with the appropriate version number (XX).

> cmake -G "Visual Studio XX" ..\work

Or if you are building for 64-bit systems.

> cmake -G "Visual Studio XX Win64" ..\work

After opening the solution (.sln) you will need to set some additional variables before running.

  • Solution Explorer > base > [right click] > Set as StartUp Project
  • Solution Explorer > base > [right click] > Properties > Configuration Properties > Debugging
    • Select All Configurations from the configuration drop-down
    • Set Working Directory to (SolutionDir)../work
    • Set Command Arguments to whatever is required by your program

OSX

XCode

Xcode is an IDE that offers a little more than simple text editing. The setup again is very similar to Eclipse.

$ cd build
$ cmake -G "Xcode" ../work
$ cd ..

Once you're setup, you can build your project with Xcode, but have to execute your program with the terminal (making sure you are in the root directory).

$ ./build/bin/base [args..]

CGRA Library

In addition to the math library and other external libraries, this project provides some simple classes and functions (in the cgra namespace) to get started with a graphics application. Further description and documentation can be found in the respective headers.

File Description
cgra_geometry.hpp Utility functions for drawing basic geometry like spheres
cgra_gui.hpp Provides methods for setting up and rendering ImGui
cgra_image.hpp An image class that can loaded from and saved to a file
cgra_mesh.hpp Mesh builder class for simple position/normal/uvs meshes
cgra_shader.hpp Shader builder class for compiling shaders from files or strings
cgra_wavefront.hpp Minimum viable wavefront asset loader function that returns a mesh_builder

In particular, the rgba_image, shader_builder, and mesh_builder classes are designed to hold data on the CPU and provide a way to upload this data to OpenGL. They are not responsible for deallocating these objects.

etc

  • If you add new source files, put them in /src, and they would be added to the project automatically based on their extension.
  • In VS, for example, don't forget to change the build type to debug (for debugging) or release (fast execution) as needed.
  • When submitting your work, only submit your work directory--don't submit the build directory.

cgra350_project's People

Contributors

henrylee0314 avatar bonny2016 avatar

cgra350_project's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.