SlideShare a Scribd company logo
1 of 42
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
1
.1.
Akashdeep Singh Jandu
Copyright@2012 by Jim X. Chen:
jchen@gmu.edu
2
Setting Up Working Environment
for JOGL
• http://www.cs.gmu.edu/~jchen/
graphics/setup.html
– Installing a Java IDE
• (Eclipse, jGRASP, netbeans, or JBuilder)
– Installing JOGL libraries
Windows simplified instructions
• Download Eclipse or jGRASP; http://www.eclipse.org/downloads/
• Download the examples and unzip them: joglExamples2011 ;
http://www.cs.gmu.edu/~jchen/graphics/setup.html
• Download the corresponding libraries that matches your platform:
– http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1a/
They are also at:
– http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-windows-amd64.zip
– http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-windows-i586.zip
– http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-macosx-ppc.zip
– http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-macosx-universal.zip
Copyright@2012 by Jim X. Chen:
jchen@gmu.edu
3
Windows simplified instructions
Eclipse
• Start Eclipse using a working directory other than the sample programs‘.
• Create a project corresponding to the directory: joglExamples2011.
• Under ―Project->Properties-> (Java Build Path) -> Libraries‖, you can use
(Add External JARs) to add ―*.jar‖ (the two file names in the downloaded Jogl
library directory).
• Remove the two dead "*.jar" file names if you see them. They are created
when I compile my program under my specific directory.
jGRASP
• In the project under "Settings->PATH/CLASSPATH->Workspace", you can
add the directory of the ―*.dll‖ files to the system PATH window, and add
"*.jar" files with full path to the CLASSPATH window.
Now you can try the examples. They should run from here.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
4
Mac OS
• http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/joglSetup.html
1. Download Eclipse;
2. Download Mac OS X: *.jar and *.jnilib (which are packaged in the jar file:
jogl-1.1.1a-macosx-ppc.zip or jogl-1.1.1a-macosx-universal.zip depending on
your platform)
3. Copy all downloaded files into directory /System/Library/Java/Extensions/
4. Download the examples and unzip them: joglExamples2011
5. Start Eclipse, create a project corresponding to the directory:
joglExamples201
6. In eclipse, you can add "*.jar" (the two file names) under "Project-
>Properties->Libraries". Remove the two dead "*.jar" file names if you see
them. They are created when I compile my program under my specific
directory.
7. Try the examples. They should run from here.
Copyright@2012 by Jim X. Chen:
jchen@gmu.edu
5
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
6
On Windows 95, 98, NT system, or 2000
6
•Download GLUT GUI library:
http://www.xmission.com/~nate/glut.html
Or http://cs.gmu.edu/~jchen/cs451/notes/glutdlls.zip
to download precompiled glutdlls.zip for Windows 98-XP.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
7
7
1. OpenGL/Glut Configuration Tutorial On Visual C++ 6.0
I assume you have Microsoft Visual C++ installed to the default directory, c:msdev (For
your system, you may start ‗find‘ tool to find a VC++ file like gl.h, and then determine the
default directory for your system.)
A. Install OpenGL and Glut
• Create a temporary directory and extract the glutdlls.zip there. Copy all *.h files to
c:msdevincludegl; all *.lib files to c:msdevlib; and all *.dll files to
c:windowssystem32.
You are now ready to enter the fun and exciting world of OpenGL and Glut programming!
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
8
8
B. Set OpenGL or Glut in Visual C++:
• First, make sure that you've included all the necessary *.h files in your program.
You need <GL/glut.h> for Glut; or <GL/gl.h> and <afxwin.h>, and possibly
<GL/glu.h> and/or <GL/glaux.h> for OpenGL.
•You need to let Visual C++ know that you want it to consult all the necessary
libraries. To do this, you first need to choose Settings under the Project or Build
menu item. The Settings button will appear after you compile your program once.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
9
9
• A Project Settings dialog box will now pop up. You now need to select the Link
tab. Unfortunately, the Link tab may be hidden. Click the half-a-tab circled below...
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
10
1
0
...and the Link page will magically appear:
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
11
1
1
• The Object/library modules section of this page which you should be interested
in is circled in red above. Scroll to the end of this line and add the necessary *.lib
files to the list.
• There are four libraries that you might need to add: opengl32.lib, glu32.lib,
glaux.lib, and glut32.lib. Since it doesn't hurt much to have extra libs listed, I
suggest you add all of them.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
12
1
2
C. Compile and run the following program
Source code examples can be downloaded from
ftp://ftp.sgi.com/opengl/opengl12.zip
Or
http://cs.gmu.edu/~jchen/cs451/notes/opengl12.zip
/* Example 1.1.point.c: draw multiple randomly generated points */
// by Jim X. Chen; September 2000
PointsPoints.c
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
13
1. Extract the glutdlls.zip
• Copy all *.h files to C:Program FilesMicrosoft Visual Studio .NET
2003Vc7includegl; (if gl directory is not exist, create one); all *.lib files
to C:Program FilesMicrosoft Visual Studio .NET 2003Vc7lib; and all *.dll
files to c:windowssystem32.
2. Start Visual Studio
• Under the file menu select New Project
• In the ―New Project Window‖, select ―Visual C++ Projects‖ on the left
hand side and select ―Win32 console project‖ on the right hand side
Specify name and location of the project
• In the ―Win32 Application Wizard Window ‖, select the ―Application
Settings‖; then click ―Empty Project‖
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
14
• Now the project is open; right click on the ―Source Files‖ folder (on
the right); select ―Add‖ ―Add New Item‖ ―C++ file‖
Name the file, and copy whatever code to this file, and run.
2. To build and run your project, hit “F5”
3. Point Visual Studio to the relevant GLUT files
(Optional, if you put your glut under C:/my/glut/)
• Right click on your project name (on the right hand side) or pull
down the Project menu
Select ―Properties‖ ―C/C++‖ properties
Select ―General‖and add the following line to ―Additional Include
Directories‖ ―C:/my/glut/include‖
• Select the ―Linker‖ properties ―General‖ and add the following line
to ―Additional Library Directories‖ ―C:/my/glut/‖
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
15
15
2. OpenGL/Glut Tutorial On Borland C++
Please visit web site for detail:
http://home.clara.net/paulyg/ogl.htm
http://www.gnt.net/~heiman/opengl.htm
http://www.opengl.org/Coding/Coding.html
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
16
On SGI Workstations (ST Rm228 and Graphics Lab.)
16
• The system administrator should have OpenGL library installed. Check this with
your system administrator
• Download GLUT GUI library for SGI: Go to web site:
http://reality.sgi.com/opengl/glut3/glut3.html
• Get GLUT documents from the same place
• Following the instructions to compile and configure GLUT on your system
• GLUT Online help: http://reality.sgi.com/opengl/spec3/spec3.html
•Sample code: ftp://ftp.sgi.com/opengl/opengl12.tar.Z
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
17
On SUN Workstations (ST2 SITE Lab.)
17
• First we'll create directories for AUX and then copy AUX files from system directories.
(Here we use aux GUI library)
mkdir $HOME/OpenGL
mkdir $HOME/OpenGL/aux
mkdir $HOME/OpenGL/aux/examples
mkdir $HOME/OpenGL/aux/libaux
mkdir $HOME/OpenGL/aux/libtk
cd /usr/openwin/share/src/GL/contrib/utils/aux
cp ./aux/examples $HOME/OpenGL/aux/examples
cp ./aux/libaux $HOME/OpenGL/aux/libaux
cp ./aux/libtk $HOME/OpenGL/aux/libtk
OR just run the following command:
cp -r ~xwang1/OpenGL $HOME/OpenGL
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
18
Reference web site:
http://sun.com/software/graphics/OpenGL/
•After that, you have your environment ready. Now you can compile and run some
example program.
•First change to the examples directory under your account by:
cd $HOME/OpenGL/aux/examples
•then compile an example program (movelight.c) by
make movelight
•finnally, run ‗movelight‘, and you will see the result.
18
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
19
Microsoft .NET development
environment and C#
• C# (pronounced "C sharp") for the new Microsoft
.NET development environment provides tools
and services that fully exploit both computing and
communications.
• C# is generally regarded as being a successor to
C++ that incorporates and improves upon the
major innovations made in the Java programming
language.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
20
C# OpenGL Wrapper
• There is not yet a version of .NET which supports
OpenGL. But you may find several C# OpenGL
wrappers that are freely available. Google search
with the key words ―C# OpenGL wrapper‖.
• The simplest C# OpenGL wrapper will be ―Colin
Fahey's C# OpenGL Wrapper‖. Detailed
information about this wrapper may be found at
http://www.colinfahey.com/opengl/csharp.htm.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
21
C# OpenGL Wrapper
• Another open source wrapper CsGL at
http://csgl.sourceforge.net/.
• It is recommended to use Colin Fahey's C#
OpenGL Wrapper because it‘s simpler and rather
easier to install.
• If you will be using Microsoft .NET to do your
project, please make sure to include the
information about the type of wrapper you are
using and the steps of running your project
when submitting it.
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
22
Other References on Setting up
your Graphics programming
environment• http://www.cs.uml.edu/~hmasterm/Environments/environment.html
• Set up DirectX programming environment (Visual C++)
22
Jim X. Chen, Ph.D.
Director of Computer Graphics Lab
George Mason University
23Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
• Jim. X Chen and Chunyang Chen, Foundations of 3D Graphics
Programming, Springer Verlag, Second Edition, required text book.
• Jim. X Chen, Guide to 3D Graphics Tools, Second Edition, Springer
Verlag, companion in C with a survey of graphics tools.
• Mason Woo, Jackie Neider, and Tom Davis, OpenGL Programming Guide,
Addison Wesley. Programming examples
• James D. Foley, Andries van Dam, Steven K. Feiner and John F. Hughes,
Computer Graphics: Principles and Practice, Addison Wesley. Detailed
theory in depth.
• Donald Hearn and M. Pauline Baker, Computer Graphics, Printice-Hall.
Easy to read textbook for undergraduates. Contains more than enough.
24
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
• Objectives
– Introduce basic graphics concepts
• object, model, image, graphics library, frame
buffer, scan-conversion, clipping, and anti-aliasing
– Set up OpenGL programming environment
– Understand simple OpenGL programs
25
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
Computer Graphics
• CG displays or animates real or imaginary
objects from their computer-based models;
– Modeling creating and modifying a model
• image processing treats the inverse process:
the analysis of images, pattern recognition, or
the reconstruction of 2D or 3D objects from
images.
26
Points Lights nfacesRaytracing
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
• A graphics display is a drawing area comprised of an
array of fine points called pixels (picture elements).
• At the heart of a graphics system there is a magic pen,
– move at lightning speed to a specific pixel
– draw the pixel with a specific color — a red, green, and blue
(RGB) vector value.
– Computer graphics is about using this pen automatically through
programming.
Display
27
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
• A real or imaginary object is represented in a computer as
a model, and is displayed as an image.
• A model is an abstract description of the object‘s shape
(vertices) and attributes (colors),
– which can be used to find all the points on the object
corresponding to the pixels in the drawing area.
– Given a model, the application program will control the pen
through a graphics library to generate the corresponding image.
• An image is simply a 2D array of pixels.
Object, Model, and Image
28
tank
Copyright @ 2005 by Jim X. Chen:
jchen@cs.gmu.edu
2
9
•User controls the creation, modification, and
animation of the models through input devices
(keyboard & mouse)
spider
Interactive
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
• A graphics library provides a set of graphics commands or
functions.
– bound in C, Java, or other programming languages on different
platforms.
– specify primitive 2D and 3D geometric models to be digitized and
displayed.
• Primitive models or simply primitives stand for some
simple shapes (such as points, lines, and polygons)
• OpenGL is a graphics library; DirectX includes a graphics
library Direct3D
Primitive and Graphics Library
30
Primitive
Lab
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
• OpenGL is the most widely used graphics library (GL) or
application programming interface (API )
• Compile and run Example J1_0_Point.java
– To change the font size in Eclipes: Window->Preferences…
General->Colors and Fonts->Basic->Text Font, then select.
– Corresponding example in C: 1.1.point.c
• links to all the example programs, and setting up working
environments on different platforms:
– http://www.cs.gmu.edu/~jchen/graphics/
OpenGL Programming
31
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
/* draw a point */
/* Java‘s supplied classes are ―imported‖. Here the awt (Abstract
Windowing Toolkit) is imported to provide ―Frame‖ class, which
includes windowing functions
*/
import java.awt.*;
// JOGL: OpenGL functions
import net.java.games.jogl.*;
32
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
/* Java class definition: ―extends‖ means ―inherits‖. So J1_0_Point is a subclass
of Frame, and it inherits Frame‘s variables and methods. ―implements‖ means
GLEventListener is an interface, which only defines methods
(init(), reshape(), display(), and displaychanged()) without implementation.
These methods are actually callback functions handling events. J1_0_Point
will implement GLEventListener‘s methods and use them for different events.
*/
public class J1_0_Point extends Frame implements GLEventListener {
static int HEIGHT = 400, WIDTH = 400;
static GL gl; //interface to OpenGL
static GLCanvas canvas; // drawable in a frame
…; // methods
}
33
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
public class J1_0_Point extends Frame implements GLEventListener {
…
public J1_0_Point() { // constructor
//1. specify a drawable: canvas
GLCapabilities capabilities = new GLCapabilities();
canvas =
GLDrawableFactory.getFactory().createGLCanvas(capabilities);
//2. listen to the events related to canvas: reshape
canvas.addGLEventListener(this);
…
}
…
}
34
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
public J1_0_Point() { // constructor
…
//3. add the canvas to fill the Frame container
add(canvas, BorderLayout.CENTER);
/* In Java, a method belongs to a class object.
Here the method ―add‖ belongs to J1_0_Point‘s
instantiation, which is frame in ―main‖ function.
It is equivalent to use ―this.add(canvas, ...)‖ */
//4. interface to OpenGL functions
gl = canvas.getGL();
}
public static void main(String[] args) {
J1_0_Point frame = new J1_0_Point();
…
}
35
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
public class J1_0_Point extends Frame implements GLEventListener {
…
public static void main(String[] args) {
J1_0_Point frame = new J1_0_Point();
//5. set the size of the frame and make it visible
frame.setSize(WIDTH, HEIGHT);
frame.setVisible(true);
}
// Called once for OpenGL initialization
public void init(GLDrawable drawable) {
//6. specify a drawing color: red
gl.glColor3f(1.0f, 0.0f, 0.0f);
}
…
}
36
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
public class J1_0_Point extends Frame implements GLE ventListener {
…
// Called for handling reshaped drawing area
public void reshape(GLDrawable drawable, int x, int y,
int width, int height) {
//7. specify the drawing area (frame) coordinates
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, width, 0, height, -1.0, 1.0);
}
…
}
37
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
public class J1_0_Point extends Frame implements GLEventListener {
…
// Called for OpenGL rendering every reshape
public void display(GLDrawable drawable) {
//8. specify to draw a point
gl.glBegin(GL.GL_POINTS);
gl.glVertex2i(WIDTH/2, HEIGHT/2);
gl.glEnd();
}
// called if display mode or device are changed
public void displayChanged(GLDrawable drawable,
boolean modeChanged, boolean deviceChanged) {
}
}
38
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
/* Example 1.1.point.c: draw randomly generated points */
#include <stdlib.h>
#include <GL/glut.h>
#define Height 400
#define Width 400 Points
39
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
void display(void)
{
int x, y;
//a. generate a random point
x = rand() % Width;
y = rand() % Height;
//b. specify a drawing color: red
glColor3f(1, 0, 0);
//c. specify to draw a point
glBegin(GL_POINTS);
glVertex2i (x,y);
glEnd();
//d. start drawing
glFlush();
}
40
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
static void reshape(int w, int h)
{ //e. specify the window’s coordinates
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho(0, Width, 0, Height, -1.0, 1.0);
}
int main(int argc, char **argv)
{ //f. initialize a drawing area
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(Width, Height);
glutCreateWindow("Example 1.1.point.c");
//g. specify event callback functions
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutIdleFunc(display);
glutMainLoop();
}
41
Copyright@2011 by Jim X. Chen:
jchen@gmu.edu
Set up your programming environment
(due before next class)
1. Set up your programming environment, and run the
first sample program that draws a point (or
randomly generated points).
2. If you failed, schedule a time to come to my
office during my office hours or bring your
computer to the next class.
3. You don’t have to let me know if you succeed in
setting up your working environment.
42

More Related Content

Viewers also liked

Welcome To Frontier City!
Welcome To Frontier City!Welcome To Frontier City!
Welcome To Frontier City!guest693245
 
1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT
1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT
1214 A Carola - Sheet - A-113 - PLUMBING LAYOUTCarlos Zapanta
 
Architecture Photography
Architecture PhotographyArchitecture Photography
Architecture PhotographyIrina Bulat
 
الفصل الثاني عام
الفصل الثاني عامالفصل الثاني عام
الفصل الثاني عامdrgamalmostafa
 
الترقيم وثيقة 9 اساسي
الترقيم وثيقة 9 اساسي الترقيم وثيقة 9 اساسي
الترقيم وثيقة 9 اساسي messaoudi mohamed
 
دليلك للتصميم الهندسى - الخطوة 2
دليلك للتصميم الهندسى - الخطوة 2دليلك للتصميم الهندسى - الخطوة 2
دليلك للتصميم الهندسى - الخطوة 2Mahmoud Abdelaal
 
My creative portfolio
My creative portfolioMy creative portfolio
My creative portfolioManzoor Manu
 
الرسم
الرسم الرسم
الرسم mish99
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introductionPeter Gfader
 
Sections القطاعات - إسقاط قطاعات الأجسام
Sections   القطاعات - إسقاط قطاعات الأجسامSections   القطاعات - إسقاط قطاعات الأجسام
Sections القطاعات - إسقاط قطاعات الأجسامأحمد دعبس
 
Quantity Surveyor presentation
Quantity Surveyor presentationQuantity Surveyor presentation
Quantity Surveyor presentationcynfang Fong
 
One point perspective
One point perspectiveOne point perspective
One point perspectivemarsha devine
 
Drawing 2 point perspective - step by step guide
Drawing 2 point perspective - step by step guideDrawing 2 point perspective - step by step guide
Drawing 2 point perspective - step by step guideSteve Webb
 
The artisan a_sustainable_entrepreneur_1
The artisan a_sustainable_entrepreneur_1The artisan a_sustainable_entrepreneur_1
The artisan a_sustainable_entrepreneur_1Ralph Cassar
 
التمارين المحلولة لكتاب الرسم الهندسي 1 - copy
التمارين المحلولة لكتاب الرسم الهندسي 1 - copyالتمارين المحلولة لكتاب الرسم الهندسي 1 - copy
التمارين المحلولة لكتاب الرسم الهندسي 1 - copyelsayedelsman
 
Quantity Surveying
Quantity SurveyingQuantity Surveying
Quantity Surveyinggeddolan
 
Perspective drawing 1 point a
Perspective drawing 1 point aPerspective drawing 1 point a
Perspective drawing 1 point arangcapan
 

Viewers also liked (20)

Welcome To Frontier City!
Welcome To Frontier City!Welcome To Frontier City!
Welcome To Frontier City!
 
C3 Slideshow
C3 SlideshowC3 Slideshow
C3 Slideshow
 
1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT
1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT
1214 A Carola - Sheet - A-113 - PLUMBING LAYOUT
 
Architecture Photography
Architecture PhotographyArchitecture Photography
Architecture Photography
 
الفصل الثاني عام
الفصل الثاني عامالفصل الثاني عام
الفصل الثاني عام
 
الترقيم وثيقة 9 اساسي
الترقيم وثيقة 9 اساسي الترقيم وثيقة 9 اساسي
الترقيم وثيقة 9 اساسي
 
دليلك للتصميم الهندسى - الخطوة 2
دليلك للتصميم الهندسى - الخطوة 2دليلك للتصميم الهندسى - الخطوة 2
دليلك للتصميم الهندسى - الخطوة 2
 
My creative portfolio
My creative portfolioMy creative portfolio
My creative portfolio
 
الرسم المنظوري
الرسم المنظوريالرسم المنظوري
الرسم المنظوري
 
الرسم
الرسم الرسم
الرسم
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
Sections القطاعات - إسقاط قطاعات الأجسام
Sections   القطاعات - إسقاط قطاعات الأجسامSections   القطاعات - إسقاط قطاعات الأجسام
Sections القطاعات - إسقاط قطاعات الأجسام
 
Quantity Surveyor presentation
Quantity Surveyor presentationQuantity Surveyor presentation
Quantity Surveyor presentation
 
Exposé politique
Exposé politiqueExposé politique
Exposé politique
 
One point perspective
One point perspectiveOne point perspective
One point perspective
 
Drawing 2 point perspective - step by step guide
Drawing 2 point perspective - step by step guideDrawing 2 point perspective - step by step guide
Drawing 2 point perspective - step by step guide
 
The artisan a_sustainable_entrepreneur_1
The artisan a_sustainable_entrepreneur_1The artisan a_sustainable_entrepreneur_1
The artisan a_sustainable_entrepreneur_1
 
التمارين المحلولة لكتاب الرسم الهندسي 1 - copy
التمارين المحلولة لكتاب الرسم الهندسي 1 - copyالتمارين المحلولة لكتاب الرسم الهندسي 1 - copy
التمارين المحلولة لكتاب الرسم الهندسي 1 - copy
 
Quantity Surveying
Quantity SurveyingQuantity Surveying
Quantity Surveying
 
Perspective drawing 1 point a
Perspective drawing 1 point aPerspective drawing 1 point a
Perspective drawing 1 point a
 

Similar to Akashdeepsinghjandu13

openGl configuration_in visual studio 2019.pptx
openGl configuration_in visual studio 2019.pptxopenGl configuration_in visual studio 2019.pptx
openGl configuration_in visual studio 2019.pptxMuhammadUmer787617
 
How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocksTech Bikram
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guidegilmsdn
 
Programming in c_in_7_days
Programming in c_in_7_daysProgramming in c_in_7_days
Programming in c_in_7_daysAnkit Dubey
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire coursegrades4u
 
Programming Android
Programming AndroidProgramming Android
Programming Androidleague
 
Ayw android env_setup
Ayw android env_setupAyw android env_setup
Ayw android env_setuppbeerak
 
generate IP CORES
generate IP CORESgenerate IP CORES
generate IP CORESguest296013
 
Leiningen2 - humane build management for clojure
Leiningen2 - humane build management for clojureLeiningen2 - humane build management for clojure
Leiningen2 - humane build management for clojureJohn Stevenson
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docMayurWagh46
 
Getting started with_graphics
Getting started with_graphicsGetting started with_graphics
Getting started with_graphicsPyayNA
 
01 04 - android set up and creating an android project
01  04 - android set up and creating an android project01  04 - android set up and creating an android project
01 04 - android set up and creating an android projectSiva Kumar reddy Vasipally
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...bhargavi804095
 

Similar to Akashdeepsinghjandu13 (20)

openGl configuration_in visual studio 2019.pptx
openGl configuration_in visual studio 2019.pptxopenGl configuration_in visual studio 2019.pptx
openGl configuration_in visual studio 2019.pptx
 
How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocks
 
Android studio
Android studioAndroid studio
Android studio
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guide
 
Programming in c_in_7_days
Programming in c_in_7_daysProgramming in c_in_7_days
Programming in c_in_7_days
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Prg 218 entire course
Prg 218 entire coursePrg 218 entire course
Prg 218 entire course
 
Programming Android
Programming AndroidProgramming Android
Programming Android
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
NDK Introduction
NDK IntroductionNDK Introduction
NDK Introduction
 
Eclipse - Installation and quick start guide
Eclipse - Installation and quick start guideEclipse - Installation and quick start guide
Eclipse - Installation and quick start guide
 
C in7-days
C in7-daysC in7-days
C in7-days
 
C in7-days
C in7-daysC in7-days
C in7-days
 
Ayw android env_setup
Ayw android env_setupAyw android env_setup
Ayw android env_setup
 
generate IP CORES
generate IP CORESgenerate IP CORES
generate IP CORES
 
Leiningen2 - humane build management for clojure
Leiningen2 - humane build management for clojureLeiningen2 - humane build management for clojure
Leiningen2 - humane build management for clojure
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
Getting started with_graphics
Getting started with_graphicsGetting started with_graphics
Getting started with_graphics
 
01 04 - android set up and creating an android project
01  04 - android set up and creating an android project01  04 - android set up and creating an android project
01 04 - android set up and creating an android project
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 

More from Akashdeep Singh Jandu (13)

Akashdeepsinghjandu16, environment ppt
Akashdeepsinghjandu16, environment ppt Akashdeepsinghjandu16, environment ppt
Akashdeepsinghjandu16, environment ppt
 
Akashdeepsinghjandu15
Akashdeepsinghjandu15Akashdeepsinghjandu15
Akashdeepsinghjandu15
 
Akashdeepsinghjandu14
Akashdeepsinghjandu14Akashdeepsinghjandu14
Akashdeepsinghjandu14
 
Akashdeepsinghjandu9
Akashdeepsinghjandu9Akashdeepsinghjandu9
Akashdeepsinghjandu9
 
Akashdeepsinghjandu8
Akashdeepsinghjandu8Akashdeepsinghjandu8
Akashdeepsinghjandu8
 
Akashdeepsinghjandu7
Akashdeepsinghjandu7Akashdeepsinghjandu7
Akashdeepsinghjandu7
 
Akashdeepsinghjandu6 environment
Akashdeepsinghjandu6 environmentAkashdeepsinghjandu6 environment
Akashdeepsinghjandu6 environment
 
Akashdeepsinghjandu4
Akashdeepsinghjandu4Akashdeepsinghjandu4
Akashdeepsinghjandu4
 
Akashdeepsinghjandu3
Akashdeepsinghjandu3Akashdeepsinghjandu3
Akashdeepsinghjandu3
 
Akashdeepsinghjandu2
Akashdeepsinghjandu2Akashdeepsinghjandu2
Akashdeepsinghjandu2
 
Akashdeepsinghjandu1
Akashdeepsinghjandu1Akashdeepsinghjandu1
Akashdeepsinghjandu1
 
Akashdeepsinghjandu
AkashdeepsinghjanduAkashdeepsinghjandu
Akashdeepsinghjandu
 
Akashdeepsinghjandu10
Akashdeepsinghjandu10Akashdeepsinghjandu10
Akashdeepsinghjandu10
 

Recently uploaded

Poly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptx
Poly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptxPoly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptx
Poly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptxAgrodome projects LLP
 
Group 4The Species of the Atlantic Forest.pdf
Group 4The Species of the Atlantic Forest.pdfGroup 4The Species of the Atlantic Forest.pdf
Group 4The Species of the Atlantic Forest.pdfs2015004
 
Spiders by Slidesgo - an introduction to arachnids
Spiders by Slidesgo - an introduction to arachnidsSpiders by Slidesgo - an introduction to arachnids
Spiders by Slidesgo - an introduction to arachnidsprasan26
 
Kavade Mala Call Girls 7001305949 ꧂Enjoy Escorts Service
Kavade Mala Call Girls 7001305949 ꧂Enjoy Escorts ServiceKavade Mala Call Girls 7001305949 ꧂Enjoy Escorts Service
Kavade Mala Call Girls 7001305949 ꧂Enjoy Escorts Serviceneha mumbai
 
Call In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCR
Call In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCRCall In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCR
Call In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCRjennyeacort
 
Determination of antibacterial activity of various broad spectrum antibiotics...
Determination of antibacterial activity of various broad spectrum antibiotics...Determination of antibacterial activity of various broad spectrum antibiotics...
Determination of antibacterial activity of various broad spectrum antibiotics...Open Access Research Paper
 
5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf
5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf
5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdfsrivastavaakshat51
 
Slide deck for the IPCC Briefing to Latvian Parliamentarians
Slide deck for the IPCC Briefing to Latvian ParliamentariansSlide deck for the IPCC Briefing to Latvian Parliamentarians
Slide deck for the IPCC Briefing to Latvian Parliamentariansipcc-media
 
Call Girls Abids 7001305949 all area service COD available Any Time
Call Girls Abids 7001305949 all area service COD available Any TimeCall Girls Abids 7001305949 all area service COD available Any Time
Call Girls Abids 7001305949 all area service COD available Any Timedelhimodelshub1
 
Environmental and Social Impact Assessment
Environmental and Social Impact AssessmentEnvironmental and Social Impact Assessment
Environmental and Social Impact AssessmentTesfahunTesema
 
Thessaly master plan- WWF presentation_18.04.24.pdf
Thessaly master plan- WWF presentation_18.04.24.pdfThessaly master plan- WWF presentation_18.04.24.pdf
Thessaly master plan- WWF presentation_18.04.24.pdfTheaMan11
 
Dwarka Call Girls 9643097474 Phone Number 24x7 Best Services
Dwarka Call Girls 9643097474 Phone Number 24x7 Best ServicesDwarka Call Girls 9643097474 Phone Number 24x7 Best Services
Dwarka Call Girls 9643097474 Phone Number 24x7 Best Servicesnajka9823
 
办理德州理工大学毕业证书TTU文凭学位证书
办理德州理工大学毕业证书TTU文凭学位证书办理德州理工大学毕业证书TTU文凭学位证书
办理德州理工大学毕业证书TTU文凭学位证书zdzoqco
 
Along the Lakefront, "Menacing Unknown"s
Along the Lakefront, "Menacing Unknown"sAlong the Lakefront, "Menacing Unknown"s
Along the Lakefront, "Menacing Unknown"syalehistoricalreview
 
原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证
原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证
原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证jdkhjh
 
Unit 1 - introduction to environmental studies.pdf
Unit 1 - introduction to environmental studies.pdfUnit 1 - introduction to environmental studies.pdf
Unit 1 - introduction to environmental studies.pdfRajjnish1
 

Recently uploaded (20)

Poly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptx
Poly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptxPoly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptx
Poly-film-Prefab cover agricultural greenhouse-polyhouse structure.pptx
 
Group 4The Species of the Atlantic Forest.pdf
Group 4The Species of the Atlantic Forest.pdfGroup 4The Species of the Atlantic Forest.pdf
Group 4The Species of the Atlantic Forest.pdf
 
young call girls in Janakpuri🔝 9953056974 🔝 escort Service
young call girls in Janakpuri🔝 9953056974 🔝 escort Serviceyoung call girls in Janakpuri🔝 9953056974 🔝 escort Service
young call girls in Janakpuri🔝 9953056974 🔝 escort Service
 
Spiders by Slidesgo - an introduction to arachnids
Spiders by Slidesgo - an introduction to arachnidsSpiders by Slidesgo - an introduction to arachnids
Spiders by Slidesgo - an introduction to arachnids
 
Kavade Mala Call Girls 7001305949 ꧂Enjoy Escorts Service
Kavade Mala Call Girls 7001305949 ꧂Enjoy Escorts ServiceKavade Mala Call Girls 7001305949 ꧂Enjoy Escorts Service
Kavade Mala Call Girls 7001305949 ꧂Enjoy Escorts Service
 
Call In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCR
Call In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCRCall In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCR
Call In girls Connaught Place (DELHI)⇛9711147426🔝Delhi NCR
 
Determination of antibacterial activity of various broad spectrum antibiotics...
Determination of antibacterial activity of various broad spectrum antibiotics...Determination of antibacterial activity of various broad spectrum antibiotics...
Determination of antibacterial activity of various broad spectrum antibiotics...
 
5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf
5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf
5 Wondrous Places You Should Visit at Least Once in Your Lifetime (1).pdf
 
Slide deck for the IPCC Briefing to Latvian Parliamentarians
Slide deck for the IPCC Briefing to Latvian ParliamentariansSlide deck for the IPCC Briefing to Latvian Parliamentarians
Slide deck for the IPCC Briefing to Latvian Parliamentarians
 
Call Girls Abids 7001305949 all area service COD available Any Time
Call Girls Abids 7001305949 all area service COD available Any TimeCall Girls Abids 7001305949 all area service COD available Any Time
Call Girls Abids 7001305949 all area service COD available Any Time
 
Environmental and Social Impact Assessment
Environmental and Social Impact AssessmentEnvironmental and Social Impact Assessment
Environmental and Social Impact Assessment
 
Thessaly master plan- WWF presentation_18.04.24.pdf
Thessaly master plan- WWF presentation_18.04.24.pdfThessaly master plan- WWF presentation_18.04.24.pdf
Thessaly master plan- WWF presentation_18.04.24.pdf
 
Dwarka Call Girls 9643097474 Phone Number 24x7 Best Services
Dwarka Call Girls 9643097474 Phone Number 24x7 Best ServicesDwarka Call Girls 9643097474 Phone Number 24x7 Best Services
Dwarka Call Girls 9643097474 Phone Number 24x7 Best Services
 
办理德州理工大学毕业证书TTU文凭学位证书
办理德州理工大学毕业证书TTU文凭学位证书办理德州理工大学毕业证书TTU文凭学位证书
办理德州理工大学毕业证书TTU文凭学位证书
 
Model Call Girl in Rajiv Chowk Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Rajiv Chowk Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Rajiv Chowk Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Rajiv Chowk Delhi reach out to us at 🔝9953056974🔝
 
Along the Lakefront, "Menacing Unknown"s
Along the Lakefront, "Menacing Unknown"sAlong the Lakefront, "Menacing Unknown"s
Along the Lakefront, "Menacing Unknown"s
 
原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证
原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证
原版1:1复刻塔夫斯大学毕业证Tufts毕业证留信学历认证
 
Unit 1 - introduction to environmental studies.pdf
Unit 1 - introduction to environmental studies.pdfUnit 1 - introduction to environmental studies.pdf
Unit 1 - introduction to environmental studies.pdf
 
Hot Sexy call girls in Nehru Place, 🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Nehru Place, 🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Nehru Place, 🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Nehru Place, 🔝 9953056974 🔝 escort Service
 
Call Girls In { Delhi } South Extension Whatsup 9873940964 Enjoy Unlimited Pl...
Call Girls In { Delhi } South Extension Whatsup 9873940964 Enjoy Unlimited Pl...Call Girls In { Delhi } South Extension Whatsup 9873940964 Enjoy Unlimited Pl...
Call Girls In { Delhi } South Extension Whatsup 9873940964 Enjoy Unlimited Pl...
 

Akashdeepsinghjandu13

  • 1. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 1 .1. Akashdeep Singh Jandu
  • 2. Copyright@2012 by Jim X. Chen: jchen@gmu.edu 2 Setting Up Working Environment for JOGL • http://www.cs.gmu.edu/~jchen/ graphics/setup.html – Installing a Java IDE • (Eclipse, jGRASP, netbeans, or JBuilder) – Installing JOGL libraries
  • 3. Windows simplified instructions • Download Eclipse or jGRASP; http://www.eclipse.org/downloads/ • Download the examples and unzip them: joglExamples2011 ; http://www.cs.gmu.edu/~jchen/graphics/setup.html • Download the corresponding libraries that matches your platform: – http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1a/ They are also at: – http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-windows-amd64.zip – http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-windows-i586.zip – http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-macosx-ppc.zip – http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/jogl-1.1.1a-macosx-universal.zip Copyright@2012 by Jim X. Chen: jchen@gmu.edu 3
  • 4. Windows simplified instructions Eclipse • Start Eclipse using a working directory other than the sample programs‘. • Create a project corresponding to the directory: joglExamples2011. • Under ―Project->Properties-> (Java Build Path) -> Libraries‖, you can use (Add External JARs) to add ―*.jar‖ (the two file names in the downloaded Jogl library directory). • Remove the two dead "*.jar" file names if you see them. They are created when I compile my program under my specific directory. jGRASP • In the project under "Settings->PATH/CLASSPATH->Workspace", you can add the directory of the ―*.dll‖ files to the system PATH window, and add "*.jar" files with full path to the CLASSPATH window. Now you can try the examples. They should run from here. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 4
  • 5. Mac OS • http://www.cs.gmu.edu/~jchen/graphics/jogl/notes/joglSetup.html 1. Download Eclipse; 2. Download Mac OS X: *.jar and *.jnilib (which are packaged in the jar file: jogl-1.1.1a-macosx-ppc.zip or jogl-1.1.1a-macosx-universal.zip depending on your platform) 3. Copy all downloaded files into directory /System/Library/Java/Extensions/ 4. Download the examples and unzip them: joglExamples2011 5. Start Eclipse, create a project corresponding to the directory: joglExamples201 6. In eclipse, you can add "*.jar" (the two file names) under "Project- >Properties->Libraries". Remove the two dead "*.jar" file names if you see them. They are created when I compile my program under my specific directory. 7. Try the examples. They should run from here. Copyright@2012 by Jim X. Chen: jchen@gmu.edu 5
  • 6. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 6 On Windows 95, 98, NT system, or 2000 6 •Download GLUT GUI library: http://www.xmission.com/~nate/glut.html Or http://cs.gmu.edu/~jchen/cs451/notes/glutdlls.zip to download precompiled glutdlls.zip for Windows 98-XP.
  • 7. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 7 7 1. OpenGL/Glut Configuration Tutorial On Visual C++ 6.0 I assume you have Microsoft Visual C++ installed to the default directory, c:msdev (For your system, you may start ‗find‘ tool to find a VC++ file like gl.h, and then determine the default directory for your system.) A. Install OpenGL and Glut • Create a temporary directory and extract the glutdlls.zip there. Copy all *.h files to c:msdevincludegl; all *.lib files to c:msdevlib; and all *.dll files to c:windowssystem32. You are now ready to enter the fun and exciting world of OpenGL and Glut programming!
  • 8. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 8 8 B. Set OpenGL or Glut in Visual C++: • First, make sure that you've included all the necessary *.h files in your program. You need <GL/glut.h> for Glut; or <GL/gl.h> and <afxwin.h>, and possibly <GL/glu.h> and/or <GL/glaux.h> for OpenGL. •You need to let Visual C++ know that you want it to consult all the necessary libraries. To do this, you first need to choose Settings under the Project or Build menu item. The Settings button will appear after you compile your program once.
  • 9. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 9 9 • A Project Settings dialog box will now pop up. You now need to select the Link tab. Unfortunately, the Link tab may be hidden. Click the half-a-tab circled below...
  • 10. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 10 1 0 ...and the Link page will magically appear:
  • 11. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 11 1 1 • The Object/library modules section of this page which you should be interested in is circled in red above. Scroll to the end of this line and add the necessary *.lib files to the list. • There are four libraries that you might need to add: opengl32.lib, glu32.lib, glaux.lib, and glut32.lib. Since it doesn't hurt much to have extra libs listed, I suggest you add all of them.
  • 12. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 12 1 2 C. Compile and run the following program Source code examples can be downloaded from ftp://ftp.sgi.com/opengl/opengl12.zip Or http://cs.gmu.edu/~jchen/cs451/notes/opengl12.zip /* Example 1.1.point.c: draw multiple randomly generated points */ // by Jim X. Chen; September 2000 PointsPoints.c
  • 13. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 13 1. Extract the glutdlls.zip • Copy all *.h files to C:Program FilesMicrosoft Visual Studio .NET 2003Vc7includegl; (if gl directory is not exist, create one); all *.lib files to C:Program FilesMicrosoft Visual Studio .NET 2003Vc7lib; and all *.dll files to c:windowssystem32. 2. Start Visual Studio • Under the file menu select New Project • In the ―New Project Window‖, select ―Visual C++ Projects‖ on the left hand side and select ―Win32 console project‖ on the right hand side Specify name and location of the project • In the ―Win32 Application Wizard Window ‖, select the ―Application Settings‖; then click ―Empty Project‖
  • 14. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 14 • Now the project is open; right click on the ―Source Files‖ folder (on the right); select ―Add‖ ―Add New Item‖ ―C++ file‖ Name the file, and copy whatever code to this file, and run. 2. To build and run your project, hit “F5” 3. Point Visual Studio to the relevant GLUT files (Optional, if you put your glut under C:/my/glut/) • Right click on your project name (on the right hand side) or pull down the Project menu Select ―Properties‖ ―C/C++‖ properties Select ―General‖and add the following line to ―Additional Include Directories‖ ―C:/my/glut/include‖ • Select the ―Linker‖ properties ―General‖ and add the following line to ―Additional Library Directories‖ ―C:/my/glut/‖
  • 15. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 15 15 2. OpenGL/Glut Tutorial On Borland C++ Please visit web site for detail: http://home.clara.net/paulyg/ogl.htm http://www.gnt.net/~heiman/opengl.htm http://www.opengl.org/Coding/Coding.html
  • 16. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 16 On SGI Workstations (ST Rm228 and Graphics Lab.) 16 • The system administrator should have OpenGL library installed. Check this with your system administrator • Download GLUT GUI library for SGI: Go to web site: http://reality.sgi.com/opengl/glut3/glut3.html • Get GLUT documents from the same place • Following the instructions to compile and configure GLUT on your system • GLUT Online help: http://reality.sgi.com/opengl/spec3/spec3.html •Sample code: ftp://ftp.sgi.com/opengl/opengl12.tar.Z
  • 17. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 17 On SUN Workstations (ST2 SITE Lab.) 17 • First we'll create directories for AUX and then copy AUX files from system directories. (Here we use aux GUI library) mkdir $HOME/OpenGL mkdir $HOME/OpenGL/aux mkdir $HOME/OpenGL/aux/examples mkdir $HOME/OpenGL/aux/libaux mkdir $HOME/OpenGL/aux/libtk cd /usr/openwin/share/src/GL/contrib/utils/aux cp ./aux/examples $HOME/OpenGL/aux/examples cp ./aux/libaux $HOME/OpenGL/aux/libaux cp ./aux/libtk $HOME/OpenGL/aux/libtk OR just run the following command: cp -r ~xwang1/OpenGL $HOME/OpenGL
  • 18. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 18 Reference web site: http://sun.com/software/graphics/OpenGL/ •After that, you have your environment ready. Now you can compile and run some example program. •First change to the examples directory under your account by: cd $HOME/OpenGL/aux/examples •then compile an example program (movelight.c) by make movelight •finnally, run ‗movelight‘, and you will see the result. 18
  • 19. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 19 Microsoft .NET development environment and C# • C# (pronounced "C sharp") for the new Microsoft .NET development environment provides tools and services that fully exploit both computing and communications. • C# is generally regarded as being a successor to C++ that incorporates and improves upon the major innovations made in the Java programming language.
  • 20. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 20 C# OpenGL Wrapper • There is not yet a version of .NET which supports OpenGL. But you may find several C# OpenGL wrappers that are freely available. Google search with the key words ―C# OpenGL wrapper‖. • The simplest C# OpenGL wrapper will be ―Colin Fahey's C# OpenGL Wrapper‖. Detailed information about this wrapper may be found at http://www.colinfahey.com/opengl/csharp.htm.
  • 21. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 21 C# OpenGL Wrapper • Another open source wrapper CsGL at http://csgl.sourceforge.net/. • It is recommended to use Colin Fahey's C# OpenGL Wrapper because it‘s simpler and rather easier to install. • If you will be using Microsoft .NET to do your project, please make sure to include the information about the type of wrapper you are using and the steps of running your project when submitting it.
  • 22. Copyright@2011 by Jim X. Chen: jchen@gmu.edu 22 Other References on Setting up your Graphics programming environment• http://www.cs.uml.edu/~hmasterm/Environments/environment.html • Set up DirectX programming environment (Visual C++) 22
  • 23. Jim X. Chen, Ph.D. Director of Computer Graphics Lab George Mason University 23Copyright@2011 by Jim X. Chen: jchen@gmu.edu
  • 24. Copyright@2011 by Jim X. Chen: jchen@gmu.edu • Jim. X Chen and Chunyang Chen, Foundations of 3D Graphics Programming, Springer Verlag, Second Edition, required text book. • Jim. X Chen, Guide to 3D Graphics Tools, Second Edition, Springer Verlag, companion in C with a survey of graphics tools. • Mason Woo, Jackie Neider, and Tom Davis, OpenGL Programming Guide, Addison Wesley. Programming examples • James D. Foley, Andries van Dam, Steven K. Feiner and John F. Hughes, Computer Graphics: Principles and Practice, Addison Wesley. Detailed theory in depth. • Donald Hearn and M. Pauline Baker, Computer Graphics, Printice-Hall. Easy to read textbook for undergraduates. Contains more than enough. 24
  • 25. Copyright@2011 by Jim X. Chen: jchen@gmu.edu • Objectives – Introduce basic graphics concepts • object, model, image, graphics library, frame buffer, scan-conversion, clipping, and anti-aliasing – Set up OpenGL programming environment – Understand simple OpenGL programs 25
  • 26. Copyright@2011 by Jim X. Chen: jchen@gmu.edu Computer Graphics • CG displays or animates real or imaginary objects from their computer-based models; – Modeling creating and modifying a model • image processing treats the inverse process: the analysis of images, pattern recognition, or the reconstruction of 2D or 3D objects from images. 26 Points Lights nfacesRaytracing
  • 27. Copyright@2011 by Jim X. Chen: jchen@gmu.edu • A graphics display is a drawing area comprised of an array of fine points called pixels (picture elements). • At the heart of a graphics system there is a magic pen, – move at lightning speed to a specific pixel – draw the pixel with a specific color — a red, green, and blue (RGB) vector value. – Computer graphics is about using this pen automatically through programming. Display 27
  • 28. Copyright@2011 by Jim X. Chen: jchen@gmu.edu • A real or imaginary object is represented in a computer as a model, and is displayed as an image. • A model is an abstract description of the object‘s shape (vertices) and attributes (colors), – which can be used to find all the points on the object corresponding to the pixels in the drawing area. – Given a model, the application program will control the pen through a graphics library to generate the corresponding image. • An image is simply a 2D array of pixels. Object, Model, and Image 28 tank
  • 29. Copyright @ 2005 by Jim X. Chen: jchen@cs.gmu.edu 2 9 •User controls the creation, modification, and animation of the models through input devices (keyboard & mouse) spider Interactive
  • 30. Copyright@2011 by Jim X. Chen: jchen@gmu.edu • A graphics library provides a set of graphics commands or functions. – bound in C, Java, or other programming languages on different platforms. – specify primitive 2D and 3D geometric models to be digitized and displayed. • Primitive models or simply primitives stand for some simple shapes (such as points, lines, and polygons) • OpenGL is a graphics library; DirectX includes a graphics library Direct3D Primitive and Graphics Library 30 Primitive Lab
  • 31. Copyright@2011 by Jim X. Chen: jchen@gmu.edu • OpenGL is the most widely used graphics library (GL) or application programming interface (API ) • Compile and run Example J1_0_Point.java – To change the font size in Eclipes: Window->Preferences… General->Colors and Fonts->Basic->Text Font, then select. – Corresponding example in C: 1.1.point.c • links to all the example programs, and setting up working environments on different platforms: – http://www.cs.gmu.edu/~jchen/graphics/ OpenGL Programming 31
  • 32. Copyright@2011 by Jim X. Chen: jchen@gmu.edu /* draw a point */ /* Java‘s supplied classes are ―imported‖. Here the awt (Abstract Windowing Toolkit) is imported to provide ―Frame‖ class, which includes windowing functions */ import java.awt.*; // JOGL: OpenGL functions import net.java.games.jogl.*; 32
  • 33. Copyright@2011 by Jim X. Chen: jchen@gmu.edu /* Java class definition: ―extends‖ means ―inherits‖. So J1_0_Point is a subclass of Frame, and it inherits Frame‘s variables and methods. ―implements‖ means GLEventListener is an interface, which only defines methods (init(), reshape(), display(), and displaychanged()) without implementation. These methods are actually callback functions handling events. J1_0_Point will implement GLEventListener‘s methods and use them for different events. */ public class J1_0_Point extends Frame implements GLEventListener { static int HEIGHT = 400, WIDTH = 400; static GL gl; //interface to OpenGL static GLCanvas canvas; // drawable in a frame …; // methods } 33
  • 34. Copyright@2011 by Jim X. Chen: jchen@gmu.edu public class J1_0_Point extends Frame implements GLEventListener { … public J1_0_Point() { // constructor //1. specify a drawable: canvas GLCapabilities capabilities = new GLCapabilities(); canvas = GLDrawableFactory.getFactory().createGLCanvas(capabilities); //2. listen to the events related to canvas: reshape canvas.addGLEventListener(this); … } … } 34
  • 35. Copyright@2011 by Jim X. Chen: jchen@gmu.edu public J1_0_Point() { // constructor … //3. add the canvas to fill the Frame container add(canvas, BorderLayout.CENTER); /* In Java, a method belongs to a class object. Here the method ―add‖ belongs to J1_0_Point‘s instantiation, which is frame in ―main‖ function. It is equivalent to use ―this.add(canvas, ...)‖ */ //4. interface to OpenGL functions gl = canvas.getGL(); } public static void main(String[] args) { J1_0_Point frame = new J1_0_Point(); … } 35
  • 36. Copyright@2011 by Jim X. Chen: jchen@gmu.edu public class J1_0_Point extends Frame implements GLEventListener { … public static void main(String[] args) { J1_0_Point frame = new J1_0_Point(); //5. set the size of the frame and make it visible frame.setSize(WIDTH, HEIGHT); frame.setVisible(true); } // Called once for OpenGL initialization public void init(GLDrawable drawable) { //6. specify a drawing color: red gl.glColor3f(1.0f, 0.0f, 0.0f); } … } 36
  • 37. Copyright@2011 by Jim X. Chen: jchen@gmu.edu public class J1_0_Point extends Frame implements GLE ventListener { … // Called for handling reshaped drawing area public void reshape(GLDrawable drawable, int x, int y, int width, int height) { //7. specify the drawing area (frame) coordinates gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, width, 0, height, -1.0, 1.0); } … } 37
  • 38. Copyright@2011 by Jim X. Chen: jchen@gmu.edu public class J1_0_Point extends Frame implements GLEventListener { … // Called for OpenGL rendering every reshape public void display(GLDrawable drawable) { //8. specify to draw a point gl.glBegin(GL.GL_POINTS); gl.glVertex2i(WIDTH/2, HEIGHT/2); gl.glEnd(); } // called if display mode or device are changed public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) { } } 38
  • 39. Copyright@2011 by Jim X. Chen: jchen@gmu.edu /* Example 1.1.point.c: draw randomly generated points */ #include <stdlib.h> #include <GL/glut.h> #define Height 400 #define Width 400 Points 39
  • 40. Copyright@2011 by Jim X. Chen: jchen@gmu.edu void display(void) { int x, y; //a. generate a random point x = rand() % Width; y = rand() % Height; //b. specify a drawing color: red glColor3f(1, 0, 0); //c. specify to draw a point glBegin(GL_POINTS); glVertex2i (x,y); glEnd(); //d. start drawing glFlush(); } 40
  • 41. Copyright@2011 by Jim X. Chen: jchen@gmu.edu static void reshape(int w, int h) { //e. specify the window’s coordinates glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho(0, Width, 0, Height, -1.0, 1.0); } int main(int argc, char **argv) { //f. initialize a drawing area glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE); glutInitWindowSize(Width, Height); glutCreateWindow("Example 1.1.point.c"); //g. specify event callback functions glutReshapeFunc(reshape); glutDisplayFunc(display); glutIdleFunc(display); glutMainLoop(); } 41
  • 42. Copyright@2011 by Jim X. Chen: jchen@gmu.edu Set up your programming environment (due before next class) 1. Set up your programming environment, and run the first sample program that draws a point (or randomly generated points). 2. If you failed, schedule a time to come to my office during my office hours or bring your computer to the next class. 3. You don’t have to let me know if you succeed in setting up your working environment. 42