Using OpenGL in Visual C++ - Using OpenGL in Visual C+ by...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
by Alan Oursland Copyright © 2000 Interface Technologies, Inc. All Rights Reserved. Series Overview With the release of NT 3.5, OpenGL became a part of the Windows operating system. Now with support for OpenGL in Windows 95 and Windows 98 and low priced graphics accelerators becoming readily available even on low end machines, the prospects of using OpenGL on any Windows machine is becoming more attractive every day. If you are interested in creating quality 2-D or 3-D graphics in Windows, or if you already know another variant of GL, keep reading. This tutorial will show you how to use OpenGL and some of its basic commands. GL is a programming interface designed by Silicon Graphics. OpenGL is a generic version of the interface made available to a wide variety of outside vendors in the interest of standardization of the language. OpenGL allows you to create high quality 3-D images without dealing with the heavy math usually associated with computer graphics. OpenGL handles graphics primitives, 2-D and 3-D transformations, lighting, shading, Z-buffering, hidden surface removal, and a host of other features. I'll use some of these topics in the sample programs following; others I'll leave to you to explore yourself. If you want to learn more about OpenGL you can search the MSDN website for the keyword "OpenGL". Here is the list of topics covered in this series: 1. Writing an OpenGL Program 2. Simple 2-D Graphics 3. Transformations and the Matrix Stack 4. Simple 3-D Graphics Writing an OpenGL Program The first program demonstrated here will show you the minimum requirements for setting up a Windows program to display OpenGL graphics. As GDI needs a Device Context (DC) to draw images, OpenGL requires a Rendering Context (RC). Unlike GDI, in which each GDI command requires that a DC is passed into it, OpenGL uses the concept of a current RC. Once a rendering context has been made current in a thread, all OpenGL calls in that thread will use the same current rendering context. While multiple rendering contexts may be used to draw in a single window, only one rendering context may be current at any time in a single thread. The goal of this sample is to create and make current an OpenGL rendering context. There are three steps to creating and making current a rendering context: 1. Set the window's pixel format. 2. Create the rendering context. 3. Make the rendering context current. Take the following steps to create the project: 1. Create a new Project Workspace of type "MFC AppWizard (exe)". Select the directory you where you want the project directory to be created, and type "GLSample1" as the project name. Click "Create" to enter the AppWizard. Following is a list of the steps in the AppWizard and the parameters you should enter in each of them. Any parameters not listed are optional. 2.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

Using OpenGL in Visual C++ - Using OpenGL in Visual C+ by...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online