OpenGL Programming: An Introduction with GLUT and Java, Slides of Advanced Computer Programming

An introduction to opengl programming, covering the basics of opengl as a state machine, the use of vertices to create objects, and the introduction of two matrices: modelview and projection. The document also discusses the clearing of the screen and drawing into a window using opengl, and introduces the opengl utility toolkit (glut) as a toolkit for making starting up and drawing fast and easy. The document also includes instructions on installing glut on windows and using it in java.

Typology: Slides

2012/2013

Uploaded on 04/30/2013

aradhana
aradhana 🇮🇳

4.6

(8)

119 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
OpenGL Programming
II
h
A
Introduced the basics of OpenGL
programming
OpenGL is a state machine
All objects are lists of vertices
2 matrices in OpenGL
ModelView
Projection
Last Time Today
Review a bit from last time
Work through some demos
Introduce/demo windowing toolkits
GLUT
FLTK
Docsity.com
pf3

Partial preview of the text

Download OpenGL Programming: An Introduction with GLUT and Java and more Slides Advanced Computer Programming in PDF only on Docsity!

OpenGL Programming

II

h

A

• Introduced the basics of OpenGL

programming

• OpenGL is a state machine

• All objects are lists of vertices

• 2 matrices in OpenGL

• ModelView

• Projection

Last Time Today

• Review a bit from last time

• Work through some demos

• Introduce/demo windowing toolkits

• GLUT

• FLTK

OpenGL in Java

• UPDATE: Apparently, the newest

versions of Netbeans include JOGL

bindings

• Check out http://unc-cs575-

lerch.blogspot.com

• Many thanks to Tae

Clearing the Screen

glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0); glClear(GL_C OL O R_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

To Clear The On-Screen Image And The Z-Buffer:

Our First OpenGL

Code

glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_POLYG O N); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush(); ...

Drawing into a

Window

• You specify what you want drawn with

OpenGL

• But where are you drawing it?

• Need to call the OS to get a window

• Two ways to do this:

  1. Make you learn the specifics of the

operating / windowing system

  1. Use a toolkit that hides the OS interface

UI Toolkits

• There are a lot of options to choose

from:

• GLUT

• FLTK

• QT

• wxWindows

• Cocoa

• etc.

• I’m going to demonstrate GLUT today

GLUT

• OpenGL Utility Toolkit

• Cross-Platform C++ Drawing/UI Toolkit

• Provides functions to make starting up

and drawing fast and easy

• Supports only limited user interfaces