/algosimulation

A fun place to practice 3D

Primary LanguageC++

glcrazier's 3D tour

I'm very glad that you can see this. I hope you can learn something from here.

Purpose

This repo is to demonstrate how to build a 3D world from scratch. Here I'm gonna use OpenGL|ES 3.0 to build the entire stuff. You can try it if you have an Android device which supports OpenGL|ES 3.0.

Contents

Startup Environment

The best way to learn how to set up environment is to download a sample from Android developer site and use that as a template. To render the simplest thing such as a triangle, you need at least to do the following:

  • Set up EGL which provides rendering context for OpenGL ES.
  • Set up view port.
  • Set up vertex and fragment shaders.
  • Compile and link shaders to a program which is used by OpenGL ES.
  • Create and bind a vertices array to that contains vertices of a triangle.
  • At last, invoke draw command to render.

Camera

A camera has following properties:

  1. Position.
  2. Look direction.
  3. Near and far distance.

The actions we'll take is to convert camera specification into perspective view matrix, then transform perspective view matrix to standard view volume.

Texture Mapping

Geometry

Sphere

Cube

Curves

Meshes

Polygons

Light

Physics Simulation

Water

Fire

Fog