Giter Club home page Giter Club logo

csci441's Introduction

CSCI 441 Computer Graphics OpenGL Library

CSCI441 OpenGL Library GitHub Repo

This library is intended to be used with OpenGL for CSCI441 at the Colorado School of Mines but can be used with any OpenGL application.

When building your application, this library must be compiled and linked against:

The OpenGL, GLFW, and GLEW libraries must be previously built and installed on your machine. The corresponding header files are included with this distribution for proper compilation, but proper linking is left to the user to ensure success.

Example Programs:

To build, run

make examples

then run one of the following programs:

  • ./bin/simpleobjects3: user can select which of the CSCI441 3D Objects to display using SimpleShader3 for diffuse illumination and OpenGL3DEngine for an Arcball camera
  • ./bin/simpletri2: displays a rotating triforce on the screen using SimpleShader2 and OpenGLEngine

csci441's People

Contributors

danarmor avatar jpaonemines avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

danarmor qtf0x

csci441's Issues

Document Library Files

Choose a standard documenting style and properly document all of the files. Ideally build HTML doc pages from comments.

Support GLEW or GLAD

Add compiler defined flag to include GLAD or GLEW.

#ifdef CSCI441_USING_GLAD
#include <glad/glad.h>
#else
#include <GL/glew.h>
#endif

Apply this to all files.

Add OpenGL 4.3 Debug callback

glfwWindowHint( GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE );
glEnable( GL_DEBUG_OUTPUT );

void debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* msg, const void* params);

glDebugMessageCallback( debug_callback, nullptr );
glDebugMessageControl( GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE );

Atomic Counter Shader Introspection Inaccurate

The fragment shader contains the following:

// ---------- UNIFORMS ---------- //
layout(std140) uniform MaterialInfo {
vec4 Ka;
vec4 Kd;
vec4 Ks;
float shininess;
} material;

layout(std140) uniform LightInfo {
vec4 position;
vec4 La;
vec4 Ld;
vec4 Ls;
} light;

uniform vec3 cameraPos;
uniform int colorer;
uniform uint MaxNodes;

// ---------- VARYINGS ---------- //
in VectorData {
vec3 modelPosition;
vec3 position;
vec3 normal;
} vectorsIn;

// ---------- IMAGES ---------- //
layout(binding=0, r32ui) uniform uimage2D headPointers;

// ---------- ATOMIC COUNTERS ---------- //
layout(binding=0, offset=0) uniform atomic_uint nextNodeCounter;

// ---------- BUFFERS ---------- //
struct NodeType {
vec4 color;
float depth;
uint next;
};
layout(binding=0, std430) buffer linkedLists {
NodeType nodes[];
};

and the output shows as

[INFO]: >--------------------------------------------------------<
[INFO]: | GL_ACTIVE_UNIFORMS: 15 |
[INFO]: | 0) type: mat4 name: MVP_Matrix loc: 5 |
[INFO]: | 1) type: mat4 name: modelviewMatrix loc: 1 |
[INFO]: | 2) type: int name: colorer loc: 10 |
[INFO]: | 7) type: vec3 name: cameraPos loc: 9 |
[INFO]: | 13) type: unsigned int name: MaxNodes loc: 11 |
[INFO]: | 14) type: uimage2D name: headPointers loc: 0 |
[INFO]: >--------------------------------------------------------<
[INFO]: | GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: 2 |
[INFO]: | 0) LightInfo # Uniforms: 5 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: LightInfo.position |
[INFO]: | uniform index: 3 offset: 0 |
[INFO]: | 1) type: vec4 name: LightInfo.La |
[INFO]: | uniform index: 4 offset: 16 |
[INFO]: | 2) type: vec4 name: LightInfo.Ld |
[INFO]: | uniform index: 5 offset: 32 |
[INFO]: | 3) type: vec4 name: LightInfo.Ls |
[INFO]: | uniform index: 6 offset: 48 |
[INFO]: | 4) type: atomic_uint name: nextNodeCounter |
[INFO]: | uniform index: 12 offset: 0 |
[INFO]: | 1) MaterialInfo # Uniforms: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: MaterialInfo.Ka |
[INFO]: | uniform index: 8 offset: 0 |
[INFO]: | 1) type: vec4 name: MaterialInfo.Kd |
[INFO]: | uniform index: 9 offset: 16 |
[INFO]: | 2) type: vec4 name: MaterialInfo.Ks |
[INFO]: | uniform index: 10 offset: 32 |
[INFO]: | 3) type: float name: MaterialInfo.shininess |
[INFO]: | uniform index: 11 offset: 48 |
[INFO]: | Shader Uniform Block Counts 2/70 |
[INFO]: | Vertex Shader Uniform Blocks: 0/36 |
[INFO]: | Fragment Shader Uniform Blocks: 2/36 |
[INFO]: >--------------------------------------------------------<
[INFO]: | GL_SHADER_STORAGE_BLOCK: 1 |
[INFO]: | 0) name: linkedLists index: 0 binding: 0 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | Shader Storage Block Counts: 1/32 |
[INFO]: | Vertex Shader Storage Blocks: 0/32 |
[INFO]: | Fragment Shader Storage Blocks: 1/32 |
[INFO]: >--------------------------------------------------------<
[INFO]: | GL_ATOMIC_COUNTER_BUFFER: 1 |
[INFO]: | 0) type: mat4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: mat4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: int name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec3 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: vec4 name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: float name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: atomic_uint name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: unsigned int name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | 0) type: uimage2D name: |
[INFO]: | uniform index: -1 atomic index: 0 |
[INFO]: | binding: 0 offset: 0 buffer size: 4 |
[INFO]: | Used in: Frag Shader(s) |
[INFO]: | Atomic Counter Counts: 1/ 8 |
[INFO]: | Vertex Atomic Counters: 0/ 8 |
[INFO]: | Fragment Atomic Counters: 15/ 8 |
[INFO]: \--------------------------------------------------------/

Create math quaternion helpers

Create a new namespace CSCI441::MATH namespace (or similar) that contains quaternion types and subsequent math operations.

ModelLoader: specify size of v/vn/vt/f arrays when loading file

For a performance boost, don't scan the file to count the number of vertices, normals, texCoords, faces.

Instead provide parameters to the function. These default to -1.

If vertices is -1, then scan the file and count.

Otherwise, allocate arrays to those initial sizes. If the provided size is greater than the actual encountered, print a message to the screen informing the user they allocated too much memory. If the provided size is too small, print a message to the screen informing the user they didn't allocate enough memory. TBD - resize the array? Or fail?

Create MD5Camera class

Extend abstract Camera to implement the MD5Camera format.

Store:

  • frame rate
  • number of frames
  • number of cuts
  • array of cut positions
  • array of each frame information: (1) camera world (x,y,z) position (2) camera rotation as a 3 component quaternion (3) fov

Ability to:

  • retrieve current frame view & projection matrices
  • advance to next frame
  • move to previous frame
  • set which cut to run through
  • loop through current cut (yes/no)
  • auto advance to next cut (yes/no)
  • loop through all cuts (yes/no)

objects3.hpp::drawSphere() sometimes not spheres

For some architectures, the spheres do not appear as spheres.

It is either the step size for the vertices or the indices that causes the triangles to jump across the sphere and form a very jagged cube-y looking sphere.

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.