Coder Social home page Coder Social logo

sdlgl3-wavefront's Introduction

sdlgl3-wavefront

sdlgl3-wavefront is a starting point template for a shader-based OpenGL 3.3 application which can load multiple wavefront/.obj files and textures. The renderer will load a list of objects into a single vertex buffer and glDrawRangeElementsBaseVertex is used for rendering. Other versions of OpenGL could also be used as long as shaders, buffer objects and glDrawRangeElementsBaseVertex are available. Only OpenGL 3.3 shaders are used for this template so shaders/default.vert and shaders/default.frag will need to be modified to support other versions of GLSL accordingly.

Frustum extraction and testing algorithms from http://www.crownandcutlass.com/features/technicaldetails/frustum.html have been incorporated into Frustum.cpp. After 3D model/models are loaded each disconnected mesh is put into a SceneNode structure and a bounding radius is calculated. The Renderer.renderer() is passed a camera object so the frustum matrix can be extracted every frame and every scene node in a renderer instance will be tested against the camera's frustum. This is one part of the code where many further optimizations could be made depending on the scene. Only the most basic frustum culling technique of testing a sphere is used in this project. The following unused methods are included in the Frustum class:

bool pointInFrustum( float x, float y, float z );

bool sphereInFrustum( float x, float y, float z, float radius );

float sphereInFrustumDistance( float x, float y, float z, float radius );

int spherePartiallyInFrustum( float x, float y, float z, float radius );

bool cubeInFrustum( float x, float y, float z, float size );

int cubePartiallyInFrustum( float x, float y, float z, float size );

bool polygonInFrustum(int numpoints, Point* pointlist);

The models used in this demo were derived from the Google 3D warehouse models and ariel imagery/elevation data was downloaded from http://oregonexplorer.info/

#Screenshots: alt tag alt tag

#Build instructions: Install SDL2, SDL2_image GLEW and CMake.

Generate Makefile/IDE project for example:

cmake -G"Unix Makefiles"

generates Makefile for Linux. Instructions for Windows can be found here

#License: sdlgl3-wavefront Licensed under 2 clause BSD.

GLM library licensed under MIT

SDL2 and SDL2_image library licensed under zlib

GLEW licensed under modified BSD and MIT licenses

sdlgl3-wavefront's People

Stargazers

SneakyFox avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

f1r3hydr4nt

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.