Code Monkey home page Code Monkey logo

graphics's Introduction

Graphics

  • Graphics hobby projects
  • Gfx2 is the active project.

Examples

Currently only a few of these examples are in working order. This is because of a change to the graphics library.

  • dungeon: is working ok.
  • feigenbaum: working
  • ground_mesh
  • info3ds: working
  • show_feig: working
  • simple2d
  • space
  • space2
  • view3ds: working but with bugs. (SHADOWMAPPING is broken)
  • viewmd2: working but with bugs. (SHADOWMAPPING is broken)’
  • TODO: a stand alone shadowmapping example (as simple as possible)

Gfx2/Graphics

  • diff_ms.h: Timing helpers/utils
  • error.c/h: Print OpenGL error messages
  • frame.c/h: Frames to transforms
  • image.c/h: Image loading and storing (supports RAW and PNG using libpng). Also contains a set of 2d painting functions on images.
  • matrix.c/h: Matrix library. Newer versions of OpenGL does not provide matrix manipulation functionality.
  • md2.c/h: Provides md2 loading and rendering (NEEDS TO BE UPDATED TO WORK)
  • mesh.c/h: Meshes, collections of triangles that can be rendered in one “go”.
  • multimesh.c/h: A wrapper around mesh to handle many “related” meshes at once. (NEEDS TO BE UPDATED TO WORK)
  • shader.c/h: Load and compile GLSL shaders.
  • shapes.c/h: Tools to generate some simple shapes.
  • sse_detect.h: Helpers if you want to detect SSE
  • text.c/h: Put text on Images.
  • texture.c/h: Helpers to manage OpenGL textures.
  • tools.c/h: Currently only contains a drawLine function..
  • vector.c/h: 2D/3D vector library

Meshes

A collection of vertices,normals,colors,texels and a set of indices that point out how those form triangles.

Uses OpenGL VBOs (Vertex Buffer Objects) for rendering. This means that the data is stored in GPU memory.

Also a VAO (Vertex Array Object) is used to manage the VBOs. This is right now causing some problems in my understanding of OpenGL, It seems to me that once you have created a VAO the kind of Shaders you can use to render the data is limited. The shader used MUST be compatible with the VAO in the sence that if the VAO has vertices as attrib 0 the shader must accept vertices at attrib 0. Feels like this should be captured in “types”, of the VAO and shader..

Thoughts.. Maybe I should split up meshes slightly and have a new kind of mesh that creates the VAO at the render call. This version could match up the attributes to the shader supplied and render. Slightly more general I guess. Then another kind of mesh could be compiled into a VAO and from that point on only be used with entirely compatible shaders, but more efficiently so…

Different GL buffers

  • VBO: a Vertex Buffer Object can hold for example vertices,normals…
  • VAO: a bunch of VBOs can be composed into a VAO. The VAO contains almost all the info needed to render the data. A single function call is needed to render the Object stored in the VBOs under the VAO. if glDrawElements is used then a GL_ELEMENT_ARRAY_BUFFER is also needed.
  • GL_ELEMENT_ARRAY_BUFFER: contains a set of indices.

TODO:

  • Learn more about shaders and vertex attributes. Make the mesh rendering routines “work” again.

graphics's People

Contributors

svenssonjoel avatar

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.