OpenGL & GLUT Basics    Window reshaping, Keyboard interaction, Camera,                                    Drawing objects...
Table of Contents Project using OpenGL & FreeGLUT in MSVC++ Window reshaping Keyboard Interaction Camera   Positionin...
Project using OpenGL &       FreeGLut       A reminder…
OpenGL & FreeGLUT Project Step 1 – Creating   the project   Setup OpenGL & FreeGLUT (done only once)   Open Visual Stud...
OpenGL & FreeGLUT Project                                   (2) Step 2 - Linking   Go to Project > [YourProjectName] Pro...
OpenGL & FreeGLUT Project                                    (2) Tip – the faster way to link to the libraries   Skip th...
Window reshaping  The Reshape function
Window reshaping Reshape function  Specified by glutReshapeFunc  Defines how your window reshapes  Write it once, reme...
Window reshaping     Live Demo
Keyboard interactionThe Keyboard monitoring functions
Keyboard interaction Keyboard monitoring functions  Specified by    glutKeyboardFunc    glutKeyboardUpFunc  Monitor k...
Keyboard interaction       Live Demo
Camera controlOrientation and positioning
Camera control ‘Moving the world’ method  Using the glTranslate* and glRotate* functions  You do the things the opposit...
Drawing objectsGLUT predefined objects, Coloring, Positioning
Drawing objects GLUT predefined functions   glutSolid*   glutWireframe* Coloring   glColor* - defines the current dra...
Camera control & Drawing        objects         Live Demo
Basic Lighting  Enabling lighting
Basic lighting Enabling lighting   glEnable Enabling ‘color material’                                               19
Basic Lighting    Live Demo
OpenGL Basics    курсове и уроци по програмиране, уеб дизайн – безплатно     BG Coder - онлайн състезателна система - onli...
Free Trainings @ Telerik Academy 3D Graphics      and Game Development     academy.telerik.com/.../3d-game-      develop...
Upcoming SlideShare
Loading in...5
×

8. Open GL Basics - 3D Graphics and Game Development

2,292

Published on

In this presentation, part of the 3D graphics and game develpment course, we discuss the OpenGL & GLUT Basics - window reshaping, keyboard Interaction, camera positioning, orientation, drawing objects, Coloring
http://academy.telerik.com/.../3d-game-development-opengl
Telerik Software Academy: http://www.academy.telerik.com
The website and all video materials are in Bulgarian

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,292
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
54
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "8. Open GL Basics - 3D Graphics and Game Development"

  1. 1. OpenGL & GLUT Basics Window reshaping, Keyboard interaction, Camera, Drawing objectsGeorge GeorgievTechnical TrainerGeorge AtanasovFront-End Developerhttp://academy.telerik.com
  2. 2. Table of Contents Project using OpenGL & FreeGLUT in MSVC++ Window reshaping Keyboard Interaction Camera  Positioning, orientation Drawing objects  Coloring  Positioning, orientation Basic Lighting 2
  3. 3. Project using OpenGL & FreeGLut A reminder…
  4. 4. OpenGL & FreeGLUT Project Step 1 – Creating the project  Setup OpenGL & FreeGLUT (done only once)  Open Visual Studio, Choose C++ as a language  Create a Win32 Console application  Tick “Empty project”  Add a new .cpp file  #include <glglew.h>  #include <glfreeglut.h>  int main(int argc, char ** argv) 4
  5. 5. OpenGL & FreeGLUT Project (2) Step 2 - Linking  Go to Project > [YourProjectName] Properties  From the side menu choose Configuration properties > Linker > Input  In the Additional Dependencies type in: glew32.lib freeglut.lib  Do this for both Debug and Release configurations (upper left corner in the window)  Close the properties window, you’re ready to go 5
  6. 6. OpenGL & FreeGLUT Project (2) Tip – the faster way to link to the libraries  Skip the entire Step 2  In the .cpp file write:  #pragma comment (lib, “glew32.lib”) #pragma comment (lib, “freeglut.lib”) 6
  7. 7. Window reshaping The Reshape function
  8. 8. Window reshaping Reshape function  Specified by glutReshapeFunc  Defines how your window reshapes  Write it once, remember it no more 8
  9. 9. Window reshaping Live Demo
  10. 10. Keyboard interactionThe Keyboard monitoring functions
  11. 11. Keyboard interaction Keyboard monitoring functions  Specified by  glutKeyboardFunc  glutKeyboardUpFunc  Monitor key pressing and key releasing  Doesn’t receive device information  Receives translated windows messages 11
  12. 12. Keyboard interaction Live Demo
  13. 13. Camera controlOrientation and positioning
  14. 14. Camera control ‘Moving the world’ method  Using the glTranslate* and glRotate* functions  You do the things the opposite way around  F. e., to move the camera forward, move the objects backward Using the gluLookAt function  Specifies  camera location  Viewed location 14
  15. 15. Drawing objectsGLUT predefined objects, Coloring, Positioning
  16. 16. Drawing objects GLUT predefined functions  glutSolid*  glutWireframe* Coloring  glColor* - defines the current drawing color Positioning  glTranslate* - moves the renderer by a vector  glRotate* - rotates the renderer by an Euler angle 16
  17. 17. Camera control & Drawing objects Live Demo
  18. 18. Basic Lighting Enabling lighting
  19. 19. Basic lighting Enabling lighting  glEnable Enabling ‘color material’ 19
  20. 20. Basic Lighting Live Demo
  21. 21. OpenGL Basics курсове и уроци по програмиране, уеб дизайн – безплатно BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране – Телерик академия форум програмиране, форум уеб дизайн уроци по програмиране и уеб дизайн за ученици ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET http://academy.telerik.com/ програмиране за деца – безплатни курсове и уроци ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC безплатен SEO курс - оптимизация за търсачки алго академия – състезателно програмиране, състезаниякурсове и уроци по програмиране, книги – безплатно от Наков курс мобилни приложения с iPhone, Android, WP7, PhoneGap уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop Дончо Минков - сайт за програмиране free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране безплатен курс "Качествен програмен код" безплатен курс "Разработка на софтуер в cloud среда" C# курс, програмиране, безплатно
  22. 22. Free Trainings @ Telerik Academy 3D Graphics and Game Development  academy.telerik.com/.../3d-game- development-opengl Telerik Software Academy  academy.telerik.com Telerik Academy @ Facebook  facebook.com/TelerikAcademy Telerik Software Academy Forums  forums.academy.telerik.com
  1. A particular slide catching your eye?

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

×