Setting up a program to run OpenGL GLSL

Setting up to starting with GLSL can be little complicated. This requires a few library setups and using OpenGL API to setup the pipeline. First you will need an IDE like Windows Visual Studios 2010 C++ express. You will than need to set OpenGL Extension Wrangler Library (GLEW) for the OpenGL API project. Next you will need windows management library like freeglut. Freeglut is an updated version of GLUT (OpenGL Unility Toolkit) which allows users to create and manage windows for OpenGL. Freeglut can read mouse, keyboard, and joysticks functions. Lastly you will need a math Library like GLM (OpenGL Mathematics). Here is a great link to set up GLEW and freglut.

Continue reading

Getting Started with GLSL

Computer graphics processing unit (GPU) has come a long way that now they are being used for molecular modeling, oil exploration, and machine learning. OpenGL shading language (GLSL) can harness that power using shaders. A shader is a program that runs on the graphics card. There are several different shaders with each having a specific task to accomplish on the pipeline. The shaders are linked together using an OpenGL program. The OpenGL program will send vertices and attributes down the pipeline. The shaders will use this information to create different effects from color and brightness to more complex effects like bump mapping, distortion, edge detection and motion detection.

GLSL has come a long way since it replaced OpenGL ARB Assembly Lanuage in OpenGL version 1.4. Newer graphics cards runs a higher version of GLSL that gives the ability to program different types of shaders in the pipeline These additional shaders will give you more flexibility. Today’s graphics cards also have unified shaders which allow for any type shaders to run on any computational unit on the GPU. There is also parallel processing on the GPU on which gives user rich graphics in real time.

Continue reading

GLSL Bump Mapping

This is my last post on GLSL. To tell the truth after all these post on GLSL I do not fully understand it. Either way here is bump mapping using GLSL. To make more sense of bump mapping here is an except from my project.

Bump mapping is an alternative to normal mapping in that it uses a grayscale height map instead of an RGB map. The height map determines how high something is. However, we won’t be actually moving any vertices. Like normal mapping, we will only change the normals.

As you may recall, the normal is perpendicular to the surface underneath. Another way to put it is that the normal is perpendicular to the tangent of the surface. Hence, we need to first calculate two tangents. To calculate a tangent, we need to know the height value just above and below (or to the left and to the right) of the current position. We can offset the texture coordinates in four different ways and use these offsets in four calls to texture2D. Note, for some maps, you may need to fiddle with this offset value to get something right (….this is probably why normal mapping is more prevalent in industry….). Once you have the two tangents, simply cross them and normalize to get the new normal.

I changed the camera angle to show the bumps better.

Continue reading

GLSL Normal Mapping

Here is my version of GLSL Normal Mapping. A normal map is an RGB texture where the RGB value corresponds to the XYZ of the normal. Since we are only doing mapping onto a quad, we simply need to replace (not offset) the old normal with this new read normal. There is one caveat, however. RGB values range from [0,1] while normal directional values can range from [-1,1]. The same should go for green and blue.

I tried to do Blinn-Phong reflection but i am not sure if it is correct.

Continue reading

GLSL Desert Mirage/Heat Wave Effect

Here is another GLSL code sample from my project. This one was fairly easy after they gave us the formula to use. Here is the code and image of the results.


Continue reading

GLSL Edge Detection

Here is an edge detection I created for class.  I used a Laplacian stencil sums up, down, left, and right values and subtracts them by 4 times the center value.

 


Continue reading

GLSL Phong and Gouard Shading

I recently wrote a program for class the compared Phong and Gouard shading using the OpenGL shader language GLSL. To sum it up in a couple of sentences, Gouard shading uses per-vertex shading and Phong uses per fragment/pixel shading. Gouard will look more flat shading because the triangles (triangle mesh) will have a solid color. Phong shading colors per pixel so the triangles can vary in color inside the triangles.  In GLSL the lightening calculation will be calculated in the vertex shader for Gouard and in the fragment shader for Phong.


Graveyard Database Logo

Has everything you want to know about grave yards. Plus has many celebrites and world leaders graves. Pssst it is my other site

Google + Profile
Check out Android Photo Mapping, its a app/site I been working on

  • wholesale nfl jerseys
  • wholesale nfl jerseys china
  • wholesale sports jerseys