1 / 11

Lecture 1:

Lecture 1:. Introduction. Pick Your Version of GLUT.

gary
Download Presentation

Lecture 1:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 1: Introduction

  2. Pick Your Version of GLUT OpenGL and the GLUT are available for Windows, Linux and many other Operating Systems and platforms. You will need to select your version of OpenGL/GLUT for programming. It is recommended that you choose an OS, platform and IDE that is most familiar to you. We will be using C++ as our base language in this course, however much of the programming will be calls to OpenGL and GLUT functions. It is important to get your version of the programming environemnt operational as soon as possible. This Lecture supports the use of Windows Visual Studio.NET 2005 and Dev-C++.

  3. Installing OpenGL and GLUT with Dev-C++ 1. Go to www.bloodshed.net 2. Find "whats new" news tab. It should be right in the middle of the home page. 3. Click and follow the Dev C++ Beta link and download the program. (version, v4.9.9.2) download the file that includes Dev C++ plus the Mingw/GCC compiler. 4. Choose a mirror site. 5. Install Dev C++. 6. Open Dev C++ and go to "Tools > Check for Updates/Packages". 7. Click below the "Select devpack server" and select "devpacks.org community devpacks". 8. Now click "check for updates" at the bottom of the page. scroll through the lists of packages until you find a glut package. Check the small box to the left of the name. Download it, and then the computer will install it automatically. Now you have opengl (OpenGL comes w/dev c++) and GLUT. Once you download GLUT, Dev C++ even does you a favor by creating a template for GLUT programs. To use the template, click the "multimedia" tab in the "create a project" window. The GLUT template should be there for you to use. http://www.astahost.com/info.php/installing-glut-dev-c_t14192.html

  4. Open Tools from the Menu Bar and Select Check for Updates/Packages, then Select devpaks.org Community Devpaks for the server. Click on Check for updates at the bottom of the dialog box.

  5. Scroll down to freeglut, check the box and then click on Download selected.

  6. Dev-C++ Version of GLUT Program #include <stdlib.h> void render(void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINE_LOOP); glVertex3f(-0.8,-0.8,0.0); glVertex3f( 0.8,-0.8,0.0); glVertex3f( 0.8, 0.8,0.0); glVertex3f(-0.8, 0.8,0.0); glEnd(); glFlush(); } int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(500,500); glutCreateWindow("My First openGL Program"); glutDisplayFunc(render); glutMainLoop(); return EXIT_SUCCESS; }

  7. Project Options General Win32 GUI Parameters Linker -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32

  8. Program Output

  9. Introduction to the GLUT for Windows Visual Studio.NET 2005 The GLUT (openGL Utility Toolkit) was developed by Mark Kilgard for X-Windows and was later ported to MS_Windows by Nate Robins.  The GLUT is a set of high level software tools that provide programmer access to openGL while avoiding the details of a specific GUI. This tutorial uses the latest version of the GLUT available at the GLUT HomePage. A local copy of the GLUT 3 Specification is avaliable here. If you are creating openGL applications in Linux or for the SGIs you can find supporting information at the GLUT HomePage including all source code and bindings. If you are running windows and Visual Studio.NET then you can download the necessary .dll, include and .lib files here.  Place the .dll files into Windows/System32 folder, the .lib files into the .lib folder inside C://Program Files/Microsoft Visual Studio 8/VC/lib/.  The .h files in the gl folder must be placed inside the include/gl folder.  Replace existing files only if they are older than the downloaded files. Getting Started (for PCs only) Install Microsoft Visual Studio .NET 2005 professional edition Create a New Project C++ Windows32 Console application Replace the automatically generated source code with the sample code below Compile and Run If there are build errors, comment out the offending lines of code and recompile until you get a successful execution (klugy but effective until some someone tracks down how Microsoft has "fixed" the latest edition of their IDE.  Ironic justice -- Managed DirectX is now even worse than openGL running under MS Visual Studio .NET 2005 Professional Edition.)

  10. Visual Studio.NET 2005 Version of GLUT Program #include "stdafx.h" #include <gl/glut.h> void render(void) { glClearColor(1.0,1.0,1.0,1.0); glColor3f(0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINE_LOOP); glVertex3f(-0.8,-0.8,0.0); glVertex3f( 0.8,-0.8,0.0); glVertex3f( 0.8, 0.8,0.0); glVertex3f(-0.8, 0.8,0.0); glEnd(); glFlush(); } void main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(100,100); glutInitWindowSize(500,500); glutCreateWindow("My First openGL Program"); glutDisplayFunc(render); glutMainLoop(); }

  11. Program Output

More Related