Git Product home page Git Product logo

opengl-graphing's Introduction

Quick Start

screenshot

This was originally created for an assignment in our "Advanced Graphics" module. To start:

sh build.sh && ./graph

Controls

  • arrow keys :: rotate the graph/axis around the x/y axis
  • wasd :: offset the graph/axis along the x/y axis
  • q + e :: offset the graph/axis along the z-axis
  • 0 :: display no graphs (axis only)
  • 1 :: display both graphs
  • 2 :: display 2D graph only (repositions accordingly)
  • 3 :: display 3D graph only
  • r :: reset everything
  • - :: reduce sample count
  • =+ :: increase sample count

Notes

  • Build & tested on OSX, untested on Windows/Linux/etc
  • Build in c
  • OpenGL 3.2 core profile
  • Manual perspective, shader based rotations
  • Uses glfw for input/window management
  • All the y values are scaled (x50), since they otherwise oscillate between -1 & 1
    • Could have divided the z/x values also
  • Compiled (OSX) using: gcc graph.c -I/usr/local/include -I/opt/X11/include -L/usr/local/lib -I/opt/X11/lib -w -framework OpenGL -framework Cocoa -framework IOKit -lglfw -o graph

Features

  • No noticeable lag up to 590 samples (after which it ran out of memory, 34,8690 polygons)
    • CPU usage also appears low at all times
  • ‘Camera’ movement by moving & rotating the entire graph/axis
    • Rotations/offsets done in-shader
  • Both graphs drawn in 3D space, both can be rotated/moved in the same ways, both can be displayed together or separately

License

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
                   Version 2, December 2004 

Copyright (C) 2013 Nick Barrett <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified 
copies of this license document, and changing it is allowed as long 
as the name is changed. 

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

 0. You just DO WHAT THE FUCK YOU WANT TO.

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.