0
Mohammad Shaker
Mohammadshaker.com mohammadshakergtr.wordpress.com
OpenGL Starter Course
@ZGTRShaker
Cube Maps
Cube Maps
Cube Maps
glBegin(GL_QUADS);
// Negative X
glTexCoord3f(-1.0f, -1.0f, 1.0f);
glVertex3f(-fExtent, -fExtent, fExtent);
glTe...
Texture Mapping
FPS
FPS
Frame Per Second
Lighting and Blending!
Lighting and Blending!
Combining light and texture
Lighting
Lighting
Lighting
Lighting
Lighting
Lighting
Lighting
Lighting
Lighting
Lighting
Lighting - Types
• Ambient Light: doesn’t come from any particular direction. It has an original
source somewhere, but the...
Lighting - Types
• Diffuse Light: The diffuse part of an OpenGL light is the directional component
that appears to come fr...
Lighting - Types
• Specular light: Like diffuse light, specular light is a highly directional property, but
it interacts m...
Lighting
The per-vertex specular
highlight is improved by
using separate specular
or a specular exponent
texture.
Lighting
• An unlit jet reflects no light.
Lighting
The output from the completed AMBIENT sample
program.
The output from the AMBIENT program when the light
source i...
Lighting
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values
GLfloat LightAmbient[]= { 0.5f, 0.5f,...
Lighting
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values
GLfloat LightAmbient[]= { 0.5f, 0.5f,...
Lighting
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values
GLfloat LightAmbient[]= { 0.5f, 0.5f,...
Lighting
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f }; // Ambient Light Values
GLfloat LightDiffuse[]= { 1.0f, 1.0f,...
Blending
Blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Blending
Wire Framing
Wire Framing
Shadowing
Shadowing
Shadowing
Shadowing
Shadowing
Shadowing
// Draw objects in the scene, including base plane
DrawModels(GL_TRUE);
// Enable alpha test so that shadowed fr...
Depth Buffer
Fog
Fog
• Why Fog?!
Blurring
Blurring
Blurring
Blurring
Blurring
Dynamic environment mapping
Dynamic environment mapping
Camera
Camera
Camera
Camera
Camera
Clipping
Clipping
Reflection
Reflection
Brightening
Brightening
Blooming!
Blooming!
Blooming!
Antialiasing
Anitalysing
Particles System
Particles System
Particles System
Particles System
Simple Particle System
• glTexCoord2d();
typedef struct // Create A Structure For Particle
{
bool active; // Active (Yes/N...
LensFlare
LensFlare
Shaders
Shaders
Shaders
Shaders
Shaders
Shaders
Shaders
Shaders
Shaders – Geometry Shaders
3D Object Loaders
3D Object Loaders
3D Object Loaders
3D Object Loaders
3D Object Loaders
3D Object Loaders
Terrain
Terrain
Height map
Height map
Height map
Height map
Sound Engines
Sound Engine
• Fmod
• OpenAL
• Others
End of a Very Short Intro to OpenGL
Take a Look on my other courses
@ http://www.slideshare.net/ZGTRZGTR
Available courses to the date of this slide:
http://www.mohammadshaker.com
mohammadshakergtr@gmail.com
https://twitter.com/ZGTRShaker @ZGTRShaker
https://de.linkedin.c...
OpenGL Starter L02
Upcoming SlideShare
Loading in...5
×

OpenGL Starter L02

367

Published on

A Short 2-slide Starter Course of OpenGL.

Published in: Education, Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
367
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
65
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "OpenGL Starter L02"

  1. 1. Mohammad Shaker Mohammadshaker.com mohammadshakergtr.wordpress.com OpenGL Starter Course @ZGTRShaker
  2. 2. Cube Maps
  3. 3. Cube Maps
  4. 4. Cube Maps glBegin(GL_QUADS); // Negative X glTexCoord3f(-1.0f, -1.0f, 1.0f); glVertex3f(-fExtent, -fExtent, fExtent); glTexCoord3f(-1.0f, -1.0f, -1.0f); glVertex3f(-fExtent, -fExtent, -fExtent); glTexCoord3f(-1.0f, 1.0f, -1.0f); glVertex3f(-fExtent, fExtent, -fExtent); glTexCoord3f(-1.0f, 1.0f, 1.0f); glVertex3f(-fExtent, fExtent, fExtent); …..
  5. 5. Texture Mapping
  6. 6. FPS
  7. 7. FPS Frame Per Second
  8. 8. Lighting and Blending!
  9. 9. Lighting and Blending!
  10. 10. Combining light and texture
  11. 11. Lighting
  12. 12. Lighting
  13. 13. Lighting
  14. 14. Lighting
  15. 15. Lighting
  16. 16. Lighting
  17. 17. Lighting
  18. 18. Lighting
  19. 19. Lighting
  20. 20. Lighting
  21. 21. Lighting - Types • Ambient Light: doesn’t come from any particular direction. It has an original source somewhere, but the rays of light have bounced around the room or scene and become directionless.
  22. 22. Lighting - Types • Diffuse Light: The diffuse part of an OpenGL light is the directional component that appears to come from a particular direction and is reflected off a surface with an intensity proportional to the angle at which the light rays strike the surface. Thus, the object surface is brighter if the light is pointed directly at the surface than if the light grazes the surface from a greater angle.
  23. 23. Lighting - Types • Specular light: Like diffuse light, specular light is a highly directional property, but it interacts more sharply with the surface and in a particular direction.
  24. 24. Lighting The per-vertex specular highlight is improved by using separate specular or a specular exponent texture.
  25. 25. Lighting • An unlit jet reflects no light.
  26. 26. Lighting The output from the completed AMBIENT sample program. The output from the AMBIENT program when the light source is cut in half.
  27. 27. Lighting GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f }; // Ambient Light Values GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f }; // Light Position
  28. 28. Lighting GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f }; // Ambient Light Values glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f }; // Light Position
  29. 29. Lighting GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f }; // Ambient Light Values glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light glEnable(GL_LIGHT1); // Enable Light One GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f }; // Light Position
  30. 30. Lighting GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f }; // Ambient Light Values GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f }; // Light Position if (keys['B']) // Is B Key Pressed And bp FALSE? { bp=TRUE; // If So, bp Becomes TRUE blend =!blend; // Toggle blend TRUE / FALSE if(blend) // Is blend TRUE? { glEnable(GL_BLEND); // Turn Blending On glDisable(GL_DEPTH_TEST); // Turn Depth Testing Off } else // Otherwise { glDisable(GL_BLEND); // Turn Blending Off glEnable(GL_DEPTH_TEST); // Turn Depth Testing On } }
  31. 31. Blending
  32. 32. Blending glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  33. 33. Blending glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  34. 34. Blending
  35. 35. Wire Framing
  36. 36. Wire Framing
  37. 37. Shadowing
  38. 38. Shadowing
  39. 39. Shadowing
  40. 40. Shadowing
  41. 41. Shadowing
  42. 42. Shadowing // Draw objects in the scene, including base plane DrawModels(GL_TRUE); // Enable alpha test so that shadowed fragments are discarded glAlphaFunc(GL_GREATER, 0.9f); glEnable(GL_ALPHA_TEST); glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight); // Set up shadow comparison glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE,GL_COMPARE_R_TO_TEXTURE); // Set up the eye plane for projecting the shadow map on the scene glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); glEnable(GL_TEXTURE_GEN_Q); …. DrawModels(GL_TRUE);
  43. 43. Depth Buffer
  44. 44. Fog
  45. 45. Fog • Why Fog?!
  46. 46. Blurring
  47. 47. Blurring
  48. 48. Blurring
  49. 49. Blurring
  50. 50. Blurring
  51. 51. Dynamic environment mapping
  52. 52. Dynamic environment mapping
  53. 53. Camera
  54. 54. Camera
  55. 55. Camera
  56. 56. Camera
  57. 57. Camera
  58. 58. Clipping
  59. 59. Clipping
  60. 60. Reflection
  61. 61. Reflection
  62. 62. Brightening
  63. 63. Brightening
  64. 64. Blooming!
  65. 65. Blooming!
  66. 66. Blooming!
  67. 67. Antialiasing
  68. 68. Anitalysing
  69. 69. Particles System
  70. 70. Particles System
  71. 71. Particles System
  72. 72. Particles System
  73. 73. Simple Particle System • glTexCoord2d(); typedef struct // Create A Structure For Particle { bool active; // Active (Yes/No) float life; // Particle Life float fade; // Fade Speed float r; // Red Value float g; // Green Value float b; // Blue Value float x; // X Position float y; // Y Position float z; // Z Position float xi; // X Direction float yi; // Y Direction float zi; // Z Direction float xg; // X Gravity float yg; // Y Gravity float zg; // Z Gravity } particles; // Particles particles particle[MAX_PARTICLES]; // Particle Array (Room For Particle Info)
  74. 74. LensFlare
  75. 75. LensFlare
  76. 76. Shaders
  77. 77. Shaders
  78. 78. Shaders
  79. 79. Shaders
  80. 80. Shaders
  81. 81. Shaders
  82. 82. Shaders
  83. 83. Shaders
  84. 84. Shaders – Geometry Shaders
  85. 85. 3D Object Loaders
  86. 86. 3D Object Loaders
  87. 87. 3D Object Loaders
  88. 88. 3D Object Loaders
  89. 89. 3D Object Loaders
  90. 90. 3D Object Loaders
  91. 91. Terrain
  92. 92. Terrain
  93. 93. Height map
  94. 94. Height map
  95. 95. Height map
  96. 96. Height map
  97. 97. Sound Engines
  98. 98. Sound Engine • Fmod • OpenAL • Others
  99. 99. End of a Very Short Intro to OpenGL
  100. 100. Take a Look on my other courses @ http://www.slideshare.net/ZGTRZGTR Available courses to the date of this slide:
  101. 101. http://www.mohammadshaker.com mohammadshakergtr@gmail.com https://twitter.com/ZGTRShaker @ZGTRShaker https://de.linkedin.com/pub/mohammad-shaker/30/122/128/ http://www.slideshare.net/ZGTRZGTR https://www.goodreads.com/user/show/11193121-mohammad-shaker https://plus.google.com/u/0/+MohammadShaker/ https://www.youtube.com/channel/UCvJUfadMoEaZNWdagdMyCRA http://mohammadshakergtr.wordpress.com/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×