Showing posts with label opengl. Show all posts
Showing posts with label opengl. Show all posts

Tuesday, December 10, 2013

Base3d a simple c++ library

Base3d lib C++

GitHub https://github.com/coreyauger/cpp_base3d_lib

Overview

This is a small and simple base 3d library written in C++. You would be crazy to write your own 3d library in todays world… However there are still a number of applications for using a compact 3d library to learn from or implement application specific problems.

This code was written a while back but used in a number of 3d applications during my time in University. I have decided to share it in the hopes that someone could find it as useful as I once did.

Example projects

Collision Detection Project

This project I designed a large "ball" course that I let serve as a demonstration of the physics I wrote. This was a super fun project and ended up working very well.

demo 1

Water Simulation

This was a really fun project to work on. The main idea for the movement of the water came from one of my favorite sites on the net: The good-looking textured light-sourced bouncy fun smart and stretchy page

demo 1

Radiosity

Dividing each face of our scene into light-map texel regions, we are going to perform a gathering type of radiosity solution. First by using GL to render the scene from the perspective of a texel into a hemi-cubed texture map, we solve the visibility problem. More info here

demo 1

Friday, October 25, 2013

android scala gl



android scala gl

Android OpenGL ES 2 / draw utility library written in scala
Link to source code on GitHub

Overview

This project serves to wrap up some common functionality regarding drawing to the screen on the Android platform. I am also fairly new to the scala language and have been very impressed with what I can do with it so far. I hope to continue to add more usefull utilities as I encounter a need for them.

Features

I will try to keep adding to this list as I go. For now here is a short list of features:
  • Simple OpenGL drawable class hierarchy
    • Includes Triangle, Square, Line, Sprite class
  • Simple way to extend functionality via shaders
  • DRY (Do not repeat yourself)

Example Usage

val texInfo = Drawable.loadGLTexture(imgPath)

val w = 2
val h = 2

val verts = Array(-0.5f*w,  0.5f*h, 0.0f,   // top left
                -0.5f*w, -0.5f*h, 0.0f,   // bottom left
                 0.5f*w,  0.5f*h, 0.0f,   // top right
                 -0.5f*w, -0.5f*h, 0.0f,  // bottom left    
                 0.5f*w, -0.5f*h, 0.0f,   // bottom right
                 0.5f*w,  0.5f*h, 0.0f )  // top right
val color =  Array(1.0f, 1.0f, 1.0f, 1.0f)      
val tex = Array(     0.0f, 0.0f,  // top left
                              1.0f, 0.0f,  // bottom left
                              0.0f, 1.0f,  // top right
                              1.0f, 0.0f,  // bottom left
            1.0f, 1.0f,  // bottom right
            0.0f, 1.0f) // top right

val sprite = new Sprite( verts, color, tex, texInfo.textureId)

Example Projects

I currently use this iib in an Android app "Perspective Correct" that should be out in the google play store soon ~(10/20/2013)
Here is a screen shot of the current app Perspective Correct