SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Downloaden Sie, um offline zu lesen
Graphics Programming
using OpenGL
Why OpenGL?
• Device independence
• Platform independence
– SGI Irix, Linux, Windows
• Abstractions (GL, GLU, GLUT)
• Open source
• Hardware-independent software
interface
• Support of client-server protocol
• Other APIs
– OpenInventor (object-oriented toolkit)
– DirectX (Microsoft), Java3D (Sun)
Brief Overview of OpenGL
OpenGL is a software interface that allows the programmer to
create 2D and 3D graphics images. OpenGL is both a standard API and
the implementation of that API. You can call the functions that comprise
OpenGL from a program you write and expect to see the same results no
matter where your program is running.
OpenGL is independent of the hardware, operating, and
windowing systems in use. The fact that it is windowing-system
independent, makes it portable. OpenGL program must interface with the
windowing system of the platform where the graphics are to be displayed.
Therefore, a number of windowing toolkits have been developed for use
with OpenGL.
OpenGL functions in a client/server environment. That is, the
application program producing the graphics may run on a machine other
than the one on which the graphics are displayed.The server part of
OpenGL, which runs on the workstation where the graphics are displayed,
can access whatever physical graphics device or frame buffer is available
on that machine.
OpenGL's rendering commands, however are "primitive". You can tell the
program to draw points, lines, and polygons, and you have to build more complex
entities upon these. There are no special-purpose functions that you can call to
create graphs, contour plots, maps, or any of the other elements we are used to
getting from "old standby programs”. With OpenGL, you have to build these
things up yourself.
With OpenGL any commands that you execute are executed immediately.
That is, when you tell the program to draw something, it does it right away. You
also have the option of putting commands into display lists. A display list is a not-
editable list of OpenGL commands stored for later execution. You can execute the
same display list more than once. For example, you can use display lists to
redraw the graphics whenever the user resizes the window. You can use a display
list to draw the same shape more than once if it repeats as an element of the
picture.
OpenGL is hardware-independent. Many different vendors have written
implementations that run on different hardware. These implementations are all
written to the same OpenGL standard and are required to pass strict conformance
tests. Vendors with licenses include SGI, AT&T, DEC, Evans & Sutherland,
Hitachi, IBM, Intel, Intergraph, Kendall Square Research, Kubota Pacific,
Microsoft, NEC, and RasterOps. The RS/6000 version comes with X and Motif
extensions. However X is not required to run OpenGL since OpenGL also
runs with other windowing systems.
Features in OpenGL
• Others
- atmospheric fog, alpha blending,
motion blur
• 3D Transformations
- Rotations, scaling, translation, perspective
• Colour models
- Values: R, G, B, alpha.
• Lighting
- Flat shading, Gouraud shading, Phong
shading
• Rendering
-Texture mapping
• Modeling
- non-uniform rational B-spline (NURB)
curves, surfaces
OpenGL Operation
From OpenGL reference
manual “Blue book”
Comm-
ands
What is to be
drawn?
How it is to be
drawn?
Display
List
Eval-
uator
Per-
Vertex
Opns. &
primitive
assembly
Rasteri-
zation
Per-
fragment
opns.
Texture
memory
Pixel
opns.
Frame
buffer
OpenGL
Operation
From OpenGL
reference manual
“Blue book”
Comm-
ands
Display
Lists
Eval-
uator
Per-
Vertex
Opns. &
primitive
assembly
Rasteri-
zation
Per-
frag-
ment
opns.
Pixel
opns.
Texture
memory
Frame
buffer
Can accumulate some
commands in a display list
for processing at a later
time (Batch mode). Or can
proceed immediately
through the pipeline
OpenGL
Operation
From OpenGL reference
manual “Blue book”
Comm-
ands
Display
Lists
Eval-
uator
Per-
Vertex
opns. &
primitive
assembly
Raster-
ization
Per-
frag-
ment
opns.
Pixel
opns.
Texture
memory
Frame
buffer
Provides an efficient means
for approximating curve
and surface geometry by
evaluating polynomial
commands of input values
OpenGL
Operation
From OpenGL reference
manual “Blue book”
Comm-
ands
Display
Lists
Eval-
uator
Per-
Vertex
opns. &
primitive
assembly
Raster-
ization
Per-
frag-
ment
opns.
Pixel
opns.
Texture
memory
Frame
buffer
Process geometric primitives -
points, line segments, and
polygons as vertices and are
transformed, lit, and clipped
to the viewport in preparation
for the next stage.
OpenGL
Operation
From OpenGL reference
manual “Blue book”
Comm-
ands
Display
Lists
Eval-
uator
Per-
Vertex
opns &
primitive
assembly
Raster-
ization
Per-
frag-
ment
opns.
Pixel
opns.
Texture
memory
Frame
buffer
Produces a series of
frame buffer addresses
and associated values
using a two-dimensional
description of a point,
line segment, or polygon
OpenGL
Operation
Comm-
ands
Display
Lists
Eval-
uator
Per-
Vertex
opns &
primitive
assembly
Raster-
ization
Per-
frag-
ment
opns.
Pixel
opns.
Texture
memory
Frame
buffer
From OpenGL
reference manual
“Blue book”
Z-buffering, and blending
of incoming pixel colors
with stored colors, and
masking and other logical
operations on pixel values
OpenGL
Operation
Comm-
ands
Display
Lists
Eval-
uator
Per-
Vertex
ops &
primitive
assembly
Raster-
ization
Per-
frag-
ment
opns
Pixel
opns
Texture
memory
Frame
buffer
From OpenGL
reference manual
“Blue book”
Input data can be in
the form of pixels
(image for texture
mapping) is processed
in the pixel operations
stage.
Geometric data (vertices, lines, and
polygons) follows the path through the row of
boxes that includes evaluators and per-vertex
operations, while pixel data (pixels, images,
and bitmaps) is treated differently for part of
the process.
Both types of data undergo the
rasterization and per-fragment operations
before the final pixel data is written into the
frame buffer.
OpenGL Operation
In the per-vertex operations stage of
processing, each vertex's spatial coordinates
are transformed by the modelview matrix, while
the normal vector is transformed by that
matrix's inverse and renormalized if specified.
The rasterization process produces
fragments (not pixels directly), which consists
of color, depth and a texture.
Tests and processing are performed on
fragments before they are written into the
frame buffer as pixel values.
Abstractions
GLU
• Primitives - points, line, polygons
• Shading and Colour
• Translation, rotation, scaling
• Viewing, Clipping, Texture
• Hidden surface removal
• Viewing –perspective/orthographic
• Image scaling, polygon tessellation
• Sphere, cylinders, quadratic surfaces
GLUT
• Windowing toolkit (key, mouse
handler, window events)
GL
OpenGL Drawing Primitives
OpenGL supports several basic primitive types, including points,
lines, quadrilaterals, and general polygons. All of these primitives are
specified using a sequence of vertices.
glVertex2i(Glint xi, Glint yi);
glVertex3f(Glfloat x, Glfloat y, Glfloat z);
Glfloat vertex[3];
glBegin(GL_LINES);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glEND();
Define a pair of points as:
glBegin(GL_POINTS);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glEND();
The numbers indicate the order in which the vertices have been specified.
Note that for the GL_LINES primitive only every second vertex causes a line
segment to be drawn. Similarly, for the GL_TRIANGLES primitive, every third vertex
causes a triangle to be drawn. Note that for the GL_TRIANGLE_STRIP and
GL_TRIANGLE_FAN primitives, a new triangle is produced for every additional
vertex. All of the closed primitives shown below are solid-filled, with the exception
of GL_LINE_LOOP, which only draws lines connecting the vertices.
The following code fragment illustrates an example of how the
primitive type is specified and how the sequence of vertices are
passed to OpenGL. It assumes that a window has already been opened
and that an appropriate 2D coordinate system has already been
established.
// draw several isolated points
GLfloat pt[2] = {3.0, 4.0};
glBegin(GL_POINTS);
glVertex2f(1.0, 2.0); // x=1, y=2
glVertex2f(2.0, 3.0); // x=2, y=3
glVertex2fv(pt); // x=3, y=4
glVertex2i(4,5); // x=4, y=5
glEnd();
The following code fragment specifies a 3D polygon to be drawn,
in this case a simple square. Note that in this case the same square could
have been drawn using the GL_QUADS and GL_QUAD_STRIP primitives.
GLfloat p1[3] = {0,0,1};
GLfloat p2[3] = {1,0,1};
GLfloat p3[3] = {1,1,1};
GLfloat p4[3] = {0,1,1};
glBegin(GL_POLYGON);
glVertex3fv(p1);
glVertex3fv(p2);
glVertex3fv(p3);
glVertex3fv(p4);
glEnd();
Coordinate Systems in the Graphics Pipeline
OCS - object coordinate system
WCS - world coordinate system
VCS - viewing coordinate system
CCS - clipping coordinate system
NDCS - normalized device coordinate system
DCS - device coordinate system
3D Viewing Pipeline
VM
v1,v2,…, vN
P clip
modelview
matrix
projection
matrix
world
coordinates
perspective
division
VP
viewport matrix
clip
coordinates
normalized device
coordinates
window
coordinates
object
coordinates
From F. S. Hill Jr., Computer Graphics using OpenGL
3D Viewing Pipeline
VM
v1,v2,…, vN
P clip
modelview
matrix
projection
matrix
world
coordinates
perspective
division
VP
viewport matrix
clip
coordinates
normalized device
coordinates
window
coordinates
object
coordinates
From F. S. Hill Jr., Computer Graphics using OpenGL
3D Viewing – ModelView Matrix
VM
v1,v2,
…, vN
P clip
modelview
matrix
projection
matrix
world co-
ordinates
perspective
division
VP
viewport
matrix
clip co-
ordinates
normalized
device co-
ordinates
window
coor-
dinates
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// viewing transform
gluLookAt( eyeX, eyeY, eyeZ,
lookAtX, lookAtY, lookAtZ, upX, upY, upZ);
// model transform
glTranslatef(delX, delY, delZ);
glRotatef(angle, i, j, k);
glScalef(multX,multY, multZ);
3D Viewing – Projection Matrix
VM
v1,v2,
…, vN
P clip
model
view
matrix
projection
matrix
world co-
ordinates
per-
spective
division
VP
view-
port
matrix
clip co-
ordinates
normalized
device
Coordinates
window
Coor-
dinates
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// perspective transform
gluPerspective( viewAngle, aspectRatio,nearZ,farZ );
// other commands for setting projection matrix
glFrustum(left, right, top, bottom);
glOrtho(left, right, top, bottom);
gluOrtho2D(left, right, top, bottom);
OpenGL functions for setting up transformations
modelling transformation
(modelview matrix)
glTranslatef()
glRotatef()
glScalef()
viewing transformation
(modelview matrix)
gluLookAt()
projection transformation
(projection matrix)
glFrustum()
gluPerspective()
glOrtho()
gluOrtho2D()
viewing transformation
glViewport()
Structure of a GLUT Program
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE |
GLUT_RGB | GLUT_DEPTH);
glutCreateWindow("Interactive rotating
cube"); // with size & position
glutDisplayFunc(display);
// display callback, routines for drawing
glutKeyboardFunc(myKeyHandler);
// keyboard callback
glutMouseFunc(myMouseClickHandler);
// mouse callback
glutMotionFunc(myMouseMotionHandler);
// mouse move callback
init();
glutMainLoop();
}
void display() {...}
void myKeyHandler( unsigned char key, int x,
int y) {...}
void myMouseClickHandler( int button, int
state, int x, int y ) {...}
void myMouseMotionHandler( int x, int y) {...}
glutInitDisplaymode()
Before opening a graphics window, we need to decide on the
`depth' of the buffers associated with the window. The following table
shows the types of parameters that can be stored on a per-pixel basis:
The various GLUT_* options are invoked together by OR-ing them
together, as illustrated in the example code, which creates a graphics
window which has only a single copy of all buffers (GLUT_SINGLE), does
not have an alpha buffer (GLUT_RGB), and has a depth buffer
(GLUT_DEPTH).
RGB Red, green and blue,
Typically 8 bits per pixel
GLUT_RGB
A Alpha or accumulation buffer,
Used for composting images
GLUT_RGBA
Z Depth value, used for
Z-buffer visibility tests
GLUT_DEPTH
Double buffer Extra copy of all buffers,
Used for smoothing animation
GLUT_DOUBLE
Stencil buffer Several extra bits,
Useful in composting images
GLUT_STENCIL
glutInitWindowPosition(), glutInitWindowSize(), glutCreateWindow()
These calls assign an initial position, size, and name to the window
and create the window itself.
glClearColor(), glMatrixMode(), glLoadIdentity(), glOrtho()
glClearColor() sets the colour to be used when clearing the window. The
remaining calls are used to define the type of camera projection. In this
case, an orthographic projection is specified using a call to
glOrtho(x1,x2,y1,y2,z1,z2). This defines the field of view of the camera, in
this case 0<=x<=10, 0<=y<=10, -1<=z<=1.
glutDisplayFunc(display), glutMainLoop()
This provides the name of the function you would like to have
called whenever glut thinks the window needs to be redrawn. Thus, when
the window is first created and whenever the window is uncovered or
moved, the user-defined display() function will be called.
glutDisplayFunc() registers the call-back function, while glutMainLoop()
hands execution control over to the glut library.
Viewing in 2D
void init(void) {
glClearColor(0.0, 0.0, 0.0, 0.0);
glColor3f(1.0f, 0.0f, 1.0f);
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(
0.0, // left
screenWidth, // right
0.0, // bottom
screenHeight); // top
}
Drawing in 2D
glBegin(GL_POINTS);
glVertex2d(x1, y1);
glVertex2d(x2, y2);
.
.
.
glVertex2d(xn, yn);
glEnd();
GL_LINES
GL_LINE_STRIP
GL_LINE_LOOP
GL_POLYGON
Drawing a square in OpenGL
The following code fragment demonstrates a very simple OpenGL
program which opens a graphics window and draws a square. It also
prints 'helllo world' in the console window. The code is illustrative of the
use of the glut library in opening the graphics window and managing the
display loop.
glutInit()
Following the initial print statement, the glutInit() call initializes the
GLUT library and also processes any command line options related to
glut. These command line options are window-system dependent.
display()
The display() call-back function clears the screen, sets the
current colour to red and draws a square polygon. The last call, glFlush(),
forces previously issued OpenGL commands to begin execution.
#include <stdio.h>
#include <GL/glut.h>
void display(void)
{
glClear( GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 1.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(2.0, 4.0, 0.0);
glVertex3f(8.0, 4.0, 0.0);
glVertex3f(8.0, 6.0, 0.0);
glVertex3f(2.0, 6.0, 0.0);
glEnd();
glFlush();
}
int main(int argc, char **argv)
{
printf("hello worldn");
glutInit(&argc, argv);
glutInitDisplayMode
( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(100,100);
glutInitWindowSize(300,300);
glutCreateWindow ("square");
glClearColor(0.0, 0.0, 0.0, 0.0);
// black background
glMatrixMode(GL_PROJECTION);
// setup viewing projection
glLoadIdentity();
// start with identity matrix
glOrtho(0.0, 10.0, 0.0, 10.0, -1.0, 1.0);
// setup a 10x10x2 viewing world
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Assigning Colours
OpenGL maintains a current drawing colour as part of
its state information.
The glColor() function calls are used to change the
current drawing colour - assigned using the glColor function
call.
Like glVertex(), this function exists in various
instantiations. Colour components are specified in the order of
red, green, blue. Colour component values are in the range
[0...1], where 1 corresponds to maximum intensity.
For unsigned bytes, the range corresponds to [0...255].
All primitives following the fragment of code given below
would be drawn in green, assuming no additional glColor()
function calls are used.
Color Flashing
Applications that use colors deal with them in one of two ways:
• RGB, also called TrueColor -- Every pixel has a red, green, and a blue
value associated with it.
• via a Color LookUp Table (CLUT), also called color index mode --
Every pixel has a color index associated with it. The color index is a
pointer into the color lookup table where the real RGB values reside.
The use of a color lookup table takes significantly less memory
but provides for fewer colors. Most 3D applications, and OpenGL in
particular, operate using RGB colors because it is the natural color
space for colors and lighting and shading. Color flashing will occur
when you run OpenGL. When the focus shifts to an OpenGL window,
either by clicking on it or by moving the mouse pointer to it, the way
you have instructed X to change focus, the colors of the rest of the
windows will change dramatically. When a non-OpenGL window is in
focus, the colors in the OpenGL window will change.
GLfloat myColour[3] = {0, 0, 1}; // blue
glColor3fv( myColour ); // using vector of
floats
glColor3f(1.0, 0.0, 0.0); // red using floats
glColor3ub(0, 255, 0); // green using
unsigned bytes
Assigning Colours
Current drawing colour maintained as a
state.
Colour components - red, green, blue in
range [0...1] as float or [0…255] as unsigned
byte
Colour Interpolation
If desired, a polygon can be
smoothly shaded to interpolate colours
between vertices.
This is accomplished by using the
GL_SMOOTH shading mode (the
OpenGL default) and by assigning a
desired colour to each vertex.
glShadeModel(GL_SMOOTH);
// as opposed to GL_FLAT
glBegin(GL_POLYGON);
glColor3f(1.0, 0, 0 ); // red
glVertex2d(0, 0);
glColor3f(0, 0, 1.0 ); // blue
glVertex2d(1, 0);
glColor3f(0, 1.0, 0 ); // green
glVertex2d(1, 1);
glColor3f(1.0, 1.0, 1.0 ); // white
glVertex2d(0, 1);
glEnd();
A fourth value called alpha is often appended to the colour
vector. This can be used assign a desired level of transparency to a
primitive and finds uses in compositing multiple images together. An
alpha value of 0.0 defines an opaque colour, while an alpha value of 1.0
corresponds to complete transparency.
The screen can be cleared to a particular colour as follows:
glClearcolor(1.0, 1.0, 1.0, 0.0); // sets the clear colour to
white and opaque
glClear( GL_COLOR_BUFFER_BIT); // clears the colour
frame buffer
Lighting up the 3D World
Ambient light
(source at infinity)
Diffuse light
(from a point
source)
X
Y
Z
X
Y
Z
// Enable light
glEnable(GL_LIGHT0); // can have other lights
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
GLfloat light0_colour[] = {1, 1.0, 1, 1.0};
GLfloat light0_position[] = {0.0, 1.0, 0.0, 0.0};
// Setting up light type and position
glLightfv(GL_LIGHT0, GL_AMBIENT,
light0_colour); // use GL_DIFFUSE for diffuse
glLightfv(GL_LIGHT0, GL_POSITION,
light0_position);
Demo – 2D Curves
Demo – 2D Polygon Drawing
Polyline test Polygon test
Demo – Colour Interpolation
References
• OpenGL Architecture Review Board, Dave
Shreiner, Mason Woo, Jackie Neider, Tom
Davis, OpenGL Architecture Review Board, The
OpenGL Programming Guide – The Red book,
4th edition, Addison-Wesley.
(http://www.glprogramming.com/red/
index.html)
• OpenGL Architecture Review Board, Dave
Shreiner, The OpenGL Reference Manual-
The Blue book, 4th edition, Addison-Wesley.
(http://rush3d.com/reference/opengl-
bluebook-1.0)
• F. S. Hill Jr., Computer Graphics using OpenGL,
Pearson Education, 2003.
End of Lectures on
Graphics Programming
using OpenGL

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGLGary Yeh
 
Opengl presentation
Opengl presentationOpengl presentation
Opengl presentationelnaqah
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016Mark Kilgard
 
Chapter 1 - INTRODUCTION TO VRML
Chapter 1 - INTRODUCTION TO VRMLChapter 1 - INTRODUCTION TO VRML
Chapter 1 - INTRODUCTION TO VRMLNuraini Mohd Ghani
 
Open Graphics Library
Open Graphics  Library Open Graphics  Library
Open Graphics Library Azmeen Gadit
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I💻 Anton Gerdelan
 
Skia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics EssentialsSkia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics EssentialsKyungmin Lee
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++鍾誠 陳鍾誠
 
Virtual Reality Modeling Language
Virtual Reality Modeling LanguageVirtual Reality Modeling Language
Virtual Reality Modeling LanguageSwati Chauhan
 
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio [Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio Owen Wu
 
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath YogiTekendra Nath Yogi
 
SIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGLSIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGLMark Kilgard
 
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
The Real-time Volumetric Cloudscapes of Horizon Zero DawnThe Real-time Volumetric Cloudscapes of Horizon Zero Dawn
The Real-time Volumetric Cloudscapes of Horizon Zero DawnGuerrilla
 

Was ist angesagt? (20)

OpenGL Basics
OpenGL BasicsOpenGL Basics
OpenGL Basics
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGL
 
Opengl presentation
Opengl presentationOpengl presentation
Opengl presentation
 
OpenGL L01-Primitives
OpenGL L01-PrimitivesOpenGL L01-Primitives
OpenGL L01-Primitives
 
OpenGL Texture Mapping
OpenGL Texture MappingOpenGL Texture Mapping
OpenGL Texture Mapping
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016
 
Chapter 1 - INTRODUCTION TO VRML
Chapter 1 - INTRODUCTION TO VRMLChapter 1 - INTRODUCTION TO VRML
Chapter 1 - INTRODUCTION TO VRML
 
Open Graphics Library
Open Graphics  Library Open Graphics  Library
Open Graphics Library
 
OpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference GuideOpenGL ES 3.2 Reference Guide
OpenGL ES 3.2 Reference Guide
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
 
Vulkan 1.1 Reference Guide
Vulkan 1.1 Reference GuideVulkan 1.1 Reference Guide
Vulkan 1.1 Reference Guide
 
OpenVX 1.3 Reference Guide
OpenVX 1.3 Reference GuideOpenVX 1.3 Reference Guide
OpenVX 1.3 Reference Guide
 
Skia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics EssentialsSkia & Freetype - Android 2D Graphics Essentials
Skia & Freetype - Android 2D Graphics Essentials
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++
 
Virtual Reality Modeling Language
Virtual Reality Modeling LanguageVirtual Reality Modeling Language
Virtual Reality Modeling Language
 
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio [Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
 
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
 
SIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGLSIGGRAPH Asia 2008 Modern OpenGL
SIGGRAPH Asia 2008 Modern OpenGL
 
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
The Real-time Volumetric Cloudscapes of Horizon Zero DawnThe Real-time Volumetric Cloudscapes of Horizon Zero Dawn
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
 

Andere mochten auch

OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL TransformationSandip Jadhav
 
Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...
Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...
Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...Igalia
 
Creo toolkit introduction
Creo toolkit  introductionCreo toolkit  introduction
Creo toolkit introductionSandip Jadhav
 
CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4fungfung Chen
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyMohammad Shaker
 
GStreamer support in WebKit. What's new? (GStreamer Conference 2015)
GStreamer support in WebKit. What's new? (GStreamer Conference 2015)GStreamer support in WebKit. What's new? (GStreamer Conference 2015)
GStreamer support in WebKit. What's new? (GStreamer Conference 2015)Igalia
 
GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...
GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...
GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...Igalia
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game DevelopmentMohammad Shaker
 
jQTouch at jQuery Conference 2010
jQTouch at jQuery Conference 2010jQTouch at jQuery Conference 2010
jQTouch at jQuery Conference 2010David Kaneda
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...David Kaneda
 
Introduction to open_gl_in_android
Introduction to open_gl_in_androidIntroduction to open_gl_in_android
Introduction to open_gl_in_androidtamillarasan
 
OpenGL ES Presentation
OpenGL ES PresentationOpenGL ES Presentation
OpenGL ES PresentationEric Cheng
 
OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android Arvind Devaraj
 
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver OverheadOpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver OverheadTristan Lorach
 
OpenGL ES 2.x Programming Introduction
OpenGL ES 2.x Programming IntroductionOpenGL ES 2.x Programming Introduction
OpenGL ES 2.x Programming IntroductionChamp Yen
 

Andere mochten auch (20)

XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL Transformation
 
Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...
Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...
Development of hardware-based Elements for GStreamer 1.0: A case study (GStre...
 
Creo toolkit introduction
Creo toolkit  introductionCreo toolkit  introduction
Creo toolkit introduction
 
CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with Psychology
 
Open GL Tutorial06
Open GL Tutorial06Open GL Tutorial06
Open GL Tutorial06
 
GStreamer support in WebKit. What's new? (GStreamer Conference 2015)
GStreamer support in WebKit. What's new? (GStreamer Conference 2015)GStreamer support in WebKit. What's new? (GStreamer Conference 2015)
GStreamer support in WebKit. What's new? (GStreamer Conference 2015)
 
OpenGL L04-Lighting
OpenGL L04-LightingOpenGL L04-Lighting
OpenGL L04-Lighting
 
GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...
GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...
GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware...
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game Development
 
jQTouch at jQuery Conference 2010
jQTouch at jQuery Conference 2010jQTouch at jQuery Conference 2010
jQTouch at jQuery Conference 2010
 
Introduction to LESS
Introduction to LESSIntroduction to LESS
Introduction to LESS
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
jQTouch and Titanium
jQTouch and TitaniumjQTouch and Titanium
jQTouch and Titanium
 
Introduction to open_gl_in_android
Introduction to open_gl_in_androidIntroduction to open_gl_in_android
Introduction to open_gl_in_android
 
OpenGL ES Presentation
OpenGL ES PresentationOpenGL ES Presentation
OpenGL ES Presentation
 
OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android
 
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver OverheadOpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
 
OpenGL ES 2.x Programming Introduction
OpenGL ES 2.x Programming IntroductionOpenGL ES 2.x Programming Introduction
OpenGL ES 2.x Programming Introduction
 

Ähnlich wie Opengl basics

openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.pptHIMANKMISHRA2
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Prabindh Sundareson
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsPrabindh Sundareson
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glchangehee lee
 
3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptx3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptxssuser255bf1
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfAgneshShetty
 
13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGLJungsoo Nam
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGLMegha V
 
OpenGL ES EGL Spec&APIs
OpenGL ES EGL Spec&APIsOpenGL ES EGL Spec&APIs
OpenGL ES EGL Spec&APIsJungsoo Nam
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...ICS
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityMark Kilgard
 
OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading LanguageJungsoo Nam
 
Open GL ES Android
Open GL ES AndroidOpen GL ES Android
Open GL ES AndroidMindos Cheng
 

Ähnlich wie Opengl basics (20)

openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_gl
 
Android native gl
Android native glAndroid native gl
Android native gl
 
3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptx3 CG_U1_P2_PPT_3 OpenGL.pptx
3 CG_U1_P2_PPT_3 OpenGL.pptx
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdf
 
13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGL
 
OpenGL ES EGL Spec&APIs
OpenGL ES EGL Spec&APIsOpenGL ES EGL Spec&APIs
OpenGL ES EGL Spec&APIs
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
Introduction to OpenGL.ppt
Introduction to OpenGL.pptIntroduction to OpenGL.ppt
Introduction to OpenGL.ppt
 
Data structures graphics library in computer graphics.
Data structures  graphics library in computer graphics.Data structures  graphics library in computer graphics.
Data structures graphics library in computer graphics.
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
Computer graphics workbook
Computer graphics workbookComputer graphics workbook
Computer graphics workbook
 
Open gles
Open glesOpen gles
Open gles
 
Angel
AngelAngel
Angel
 
OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading Language
 
Open GL ES Android
Open GL ES AndroidOpen GL ES Android
Open GL ES Android
 

Kürzlich hochgeladen

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfAnna Loughnan Colquhoun
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 

Kürzlich hochgeladen (20)

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdf
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 

Opengl basics

  • 2. Why OpenGL? • Device independence • Platform independence – SGI Irix, Linux, Windows • Abstractions (GL, GLU, GLUT) • Open source • Hardware-independent software interface • Support of client-server protocol • Other APIs – OpenInventor (object-oriented toolkit) – DirectX (Microsoft), Java3D (Sun)
  • 3. Brief Overview of OpenGL OpenGL is a software interface that allows the programmer to create 2D and 3D graphics images. OpenGL is both a standard API and the implementation of that API. You can call the functions that comprise OpenGL from a program you write and expect to see the same results no matter where your program is running. OpenGL is independent of the hardware, operating, and windowing systems in use. The fact that it is windowing-system independent, makes it portable. OpenGL program must interface with the windowing system of the platform where the graphics are to be displayed. Therefore, a number of windowing toolkits have been developed for use with OpenGL. OpenGL functions in a client/server environment. That is, the application program producing the graphics may run on a machine other than the one on which the graphics are displayed.The server part of OpenGL, which runs on the workstation where the graphics are displayed, can access whatever physical graphics device or frame buffer is available on that machine.
  • 4. OpenGL's rendering commands, however are "primitive". You can tell the program to draw points, lines, and polygons, and you have to build more complex entities upon these. There are no special-purpose functions that you can call to create graphs, contour plots, maps, or any of the other elements we are used to getting from "old standby programs”. With OpenGL, you have to build these things up yourself. With OpenGL any commands that you execute are executed immediately. That is, when you tell the program to draw something, it does it right away. You also have the option of putting commands into display lists. A display list is a not- editable list of OpenGL commands stored for later execution. You can execute the same display list more than once. For example, you can use display lists to redraw the graphics whenever the user resizes the window. You can use a display list to draw the same shape more than once if it repeats as an element of the picture. OpenGL is hardware-independent. Many different vendors have written implementations that run on different hardware. These implementations are all written to the same OpenGL standard and are required to pass strict conformance tests. Vendors with licenses include SGI, AT&T, DEC, Evans & Sutherland, Hitachi, IBM, Intel, Intergraph, Kendall Square Research, Kubota Pacific, Microsoft, NEC, and RasterOps. The RS/6000 version comes with X and Motif extensions. However X is not required to run OpenGL since OpenGL also runs with other windowing systems.
  • 5. Features in OpenGL • Others - atmospheric fog, alpha blending, motion blur • 3D Transformations - Rotations, scaling, translation, perspective • Colour models - Values: R, G, B, alpha. • Lighting - Flat shading, Gouraud shading, Phong shading • Rendering -Texture mapping • Modeling - non-uniform rational B-spline (NURB) curves, surfaces
  • 6. OpenGL Operation From OpenGL reference manual “Blue book” Comm- ands What is to be drawn? How it is to be drawn? Display List Eval- uator Per- Vertex Opns. & primitive assembly Rasteri- zation Per- fragment opns. Texture memory Pixel opns. Frame buffer
  • 7. OpenGL Operation From OpenGL reference manual “Blue book” Comm- ands Display Lists Eval- uator Per- Vertex Opns. & primitive assembly Rasteri- zation Per- frag- ment opns. Pixel opns. Texture memory Frame buffer Can accumulate some commands in a display list for processing at a later time (Batch mode). Or can proceed immediately through the pipeline
  • 8. OpenGL Operation From OpenGL reference manual “Blue book” Comm- ands Display Lists Eval- uator Per- Vertex opns. & primitive assembly Raster- ization Per- frag- ment opns. Pixel opns. Texture memory Frame buffer Provides an efficient means for approximating curve and surface geometry by evaluating polynomial commands of input values
  • 9. OpenGL Operation From OpenGL reference manual “Blue book” Comm- ands Display Lists Eval- uator Per- Vertex opns. & primitive assembly Raster- ization Per- frag- ment opns. Pixel opns. Texture memory Frame buffer Process geometric primitives - points, line segments, and polygons as vertices and are transformed, lit, and clipped to the viewport in preparation for the next stage.
  • 10. OpenGL Operation From OpenGL reference manual “Blue book” Comm- ands Display Lists Eval- uator Per- Vertex opns & primitive assembly Raster- ization Per- frag- ment opns. Pixel opns. Texture memory Frame buffer Produces a series of frame buffer addresses and associated values using a two-dimensional description of a point, line segment, or polygon
  • 11. OpenGL Operation Comm- ands Display Lists Eval- uator Per- Vertex opns & primitive assembly Raster- ization Per- frag- ment opns. Pixel opns. Texture memory Frame buffer From OpenGL reference manual “Blue book” Z-buffering, and blending of incoming pixel colors with stored colors, and masking and other logical operations on pixel values
  • 12. OpenGL Operation Comm- ands Display Lists Eval- uator Per- Vertex ops & primitive assembly Raster- ization Per- frag- ment opns Pixel opns Texture memory Frame buffer From OpenGL reference manual “Blue book” Input data can be in the form of pixels (image for texture mapping) is processed in the pixel operations stage.
  • 13. Geometric data (vertices, lines, and polygons) follows the path through the row of boxes that includes evaluators and per-vertex operations, while pixel data (pixels, images, and bitmaps) is treated differently for part of the process. Both types of data undergo the rasterization and per-fragment operations before the final pixel data is written into the frame buffer. OpenGL Operation
  • 14. In the per-vertex operations stage of processing, each vertex's spatial coordinates are transformed by the modelview matrix, while the normal vector is transformed by that matrix's inverse and renormalized if specified. The rasterization process produces fragments (not pixels directly), which consists of color, depth and a texture. Tests and processing are performed on fragments before they are written into the frame buffer as pixel values.
  • 15. Abstractions GLU • Primitives - points, line, polygons • Shading and Colour • Translation, rotation, scaling • Viewing, Clipping, Texture • Hidden surface removal • Viewing –perspective/orthographic • Image scaling, polygon tessellation • Sphere, cylinders, quadratic surfaces GLUT • Windowing toolkit (key, mouse handler, window events) GL
  • 16. OpenGL Drawing Primitives OpenGL supports several basic primitive types, including points, lines, quadrilaterals, and general polygons. All of these primitives are specified using a sequence of vertices. glVertex2i(Glint xi, Glint yi); glVertex3f(Glfloat x, Glfloat y, Glfloat z); Glfloat vertex[3]; glBegin(GL_LINES); glVertex2f(x1, y1); glVertex2f(x2, y2); glEND(); Define a pair of points as: glBegin(GL_POINTS); glVertex2f(x1, y1); glVertex2f(x2, y2); glEND();
  • 17. The numbers indicate the order in which the vertices have been specified. Note that for the GL_LINES primitive only every second vertex causes a line segment to be drawn. Similarly, for the GL_TRIANGLES primitive, every third vertex causes a triangle to be drawn. Note that for the GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN primitives, a new triangle is produced for every additional vertex. All of the closed primitives shown below are solid-filled, with the exception of GL_LINE_LOOP, which only draws lines connecting the vertices.
  • 18. The following code fragment illustrates an example of how the primitive type is specified and how the sequence of vertices are passed to OpenGL. It assumes that a window has already been opened and that an appropriate 2D coordinate system has already been established. // draw several isolated points GLfloat pt[2] = {3.0, 4.0}; glBegin(GL_POINTS); glVertex2f(1.0, 2.0); // x=1, y=2 glVertex2f(2.0, 3.0); // x=2, y=3 glVertex2fv(pt); // x=3, y=4 glVertex2i(4,5); // x=4, y=5 glEnd();
  • 19. The following code fragment specifies a 3D polygon to be drawn, in this case a simple square. Note that in this case the same square could have been drawn using the GL_QUADS and GL_QUAD_STRIP primitives. GLfloat p1[3] = {0,0,1}; GLfloat p2[3] = {1,0,1}; GLfloat p3[3] = {1,1,1}; GLfloat p4[3] = {0,1,1}; glBegin(GL_POLYGON); glVertex3fv(p1); glVertex3fv(p2); glVertex3fv(p3); glVertex3fv(p4); glEnd();
  • 20. Coordinate Systems in the Graphics Pipeline OCS - object coordinate system WCS - world coordinate system VCS - viewing coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device coordinate system
  • 21. 3D Viewing Pipeline VM v1,v2,…, vN P clip modelview matrix projection matrix world coordinates perspective division VP viewport matrix clip coordinates normalized device coordinates window coordinates object coordinates From F. S. Hill Jr., Computer Graphics using OpenGL
  • 22. 3D Viewing Pipeline VM v1,v2,…, vN P clip modelview matrix projection matrix world coordinates perspective division VP viewport matrix clip coordinates normalized device coordinates window coordinates object coordinates From F. S. Hill Jr., Computer Graphics using OpenGL
  • 23. 3D Viewing – ModelView Matrix VM v1,v2, …, vN P clip modelview matrix projection matrix world co- ordinates perspective division VP viewport matrix clip co- ordinates normalized device co- ordinates window coor- dinates glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // viewing transform gluLookAt( eyeX, eyeY, eyeZ, lookAtX, lookAtY, lookAtZ, upX, upY, upZ); // model transform glTranslatef(delX, delY, delZ); glRotatef(angle, i, j, k); glScalef(multX,multY, multZ);
  • 24. 3D Viewing – Projection Matrix VM v1,v2, …, vN P clip model view matrix projection matrix world co- ordinates per- spective division VP view- port matrix clip co- ordinates normalized device Coordinates window Coor- dinates glMatrixMode(GL_PROJECTION); glLoadIdentity(); // perspective transform gluPerspective( viewAngle, aspectRatio,nearZ,farZ ); // other commands for setting projection matrix glFrustum(left, right, top, bottom); glOrtho(left, right, top, bottom); gluOrtho2D(left, right, top, bottom);
  • 25. OpenGL functions for setting up transformations modelling transformation (modelview matrix) glTranslatef() glRotatef() glScalef() viewing transformation (modelview matrix) gluLookAt() projection transformation (projection matrix) glFrustum() gluPerspective() glOrtho() gluOrtho2D() viewing transformation glViewport()
  • 26. Structure of a GLUT Program int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow("Interactive rotating cube"); // with size & position glutDisplayFunc(display); // display callback, routines for drawing glutKeyboardFunc(myKeyHandler); // keyboard callback glutMouseFunc(myMouseClickHandler); // mouse callback
  • 27. glutMotionFunc(myMouseMotionHandler); // mouse move callback init(); glutMainLoop(); } void display() {...} void myKeyHandler( unsigned char key, int x, int y) {...} void myMouseClickHandler( int button, int state, int x, int y ) {...} void myMouseMotionHandler( int x, int y) {...}
  • 28. glutInitDisplaymode() Before opening a graphics window, we need to decide on the `depth' of the buffers associated with the window. The following table shows the types of parameters that can be stored on a per-pixel basis: The various GLUT_* options are invoked together by OR-ing them together, as illustrated in the example code, which creates a graphics window which has only a single copy of all buffers (GLUT_SINGLE), does not have an alpha buffer (GLUT_RGB), and has a depth buffer (GLUT_DEPTH). RGB Red, green and blue, Typically 8 bits per pixel GLUT_RGB A Alpha or accumulation buffer, Used for composting images GLUT_RGBA Z Depth value, used for Z-buffer visibility tests GLUT_DEPTH Double buffer Extra copy of all buffers, Used for smoothing animation GLUT_DOUBLE Stencil buffer Several extra bits, Useful in composting images GLUT_STENCIL
  • 29. glutInitWindowPosition(), glutInitWindowSize(), glutCreateWindow() These calls assign an initial position, size, and name to the window and create the window itself. glClearColor(), glMatrixMode(), glLoadIdentity(), glOrtho() glClearColor() sets the colour to be used when clearing the window. The remaining calls are used to define the type of camera projection. In this case, an orthographic projection is specified using a call to glOrtho(x1,x2,y1,y2,z1,z2). This defines the field of view of the camera, in this case 0<=x<=10, 0<=y<=10, -1<=z<=1. glutDisplayFunc(display), glutMainLoop() This provides the name of the function you would like to have called whenever glut thinks the window needs to be redrawn. Thus, when the window is first created and whenever the window is uncovered or moved, the user-defined display() function will be called. glutDisplayFunc() registers the call-back function, while glutMainLoop() hands execution control over to the glut library.
  • 30. Viewing in 2D void init(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glColor3f(1.0f, 0.0f, 1.0f); glPointSize(1.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D( 0.0, // left screenWidth, // right 0.0, // bottom screenHeight); // top }
  • 31. Drawing in 2D glBegin(GL_POINTS); glVertex2d(x1, y1); glVertex2d(x2, y2); . . . glVertex2d(xn, yn); glEnd(); GL_LINES GL_LINE_STRIP GL_LINE_LOOP GL_POLYGON
  • 32. Drawing a square in OpenGL The following code fragment demonstrates a very simple OpenGL program which opens a graphics window and draws a square. It also prints 'helllo world' in the console window. The code is illustrative of the use of the glut library in opening the graphics window and managing the display loop. glutInit() Following the initial print statement, the glutInit() call initializes the GLUT library and also processes any command line options related to glut. These command line options are window-system dependent. display() The display() call-back function clears the screen, sets the current colour to red and draws a square polygon. The last call, glFlush(), forces previously issued OpenGL commands to begin execution.
  • 33. #include <stdio.h> #include <GL/glut.h> void display(void) { glClear( GL_COLOR_BUFFER_BIT); glColor3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON); glVertex3f(2.0, 4.0, 0.0); glVertex3f(8.0, 4.0, 0.0); glVertex3f(8.0, 6.0, 0.0); glVertex3f(2.0, 6.0, 0.0); glEnd(); glFlush(); } int main(int argc, char **argv) { printf("hello worldn"); glutInit(&argc, argv); glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowPosition(100,100); glutInitWindowSize(300,300); glutCreateWindow ("square"); glClearColor(0.0, 0.0, 0.0, 0.0); // black background glMatrixMode(GL_PROJECTION); // setup viewing projection glLoadIdentity(); // start with identity matrix glOrtho(0.0, 10.0, 0.0, 10.0, -1.0, 1.0); // setup a 10x10x2 viewing world glutDisplayFunc(display); glutMainLoop(); return 0; }
  • 34. Assigning Colours OpenGL maintains a current drawing colour as part of its state information. The glColor() function calls are used to change the current drawing colour - assigned using the glColor function call. Like glVertex(), this function exists in various instantiations. Colour components are specified in the order of red, green, blue. Colour component values are in the range [0...1], where 1 corresponds to maximum intensity. For unsigned bytes, the range corresponds to [0...255]. All primitives following the fragment of code given below would be drawn in green, assuming no additional glColor() function calls are used.
  • 35. Color Flashing Applications that use colors deal with them in one of two ways: • RGB, also called TrueColor -- Every pixel has a red, green, and a blue value associated with it. • via a Color LookUp Table (CLUT), also called color index mode -- Every pixel has a color index associated with it. The color index is a pointer into the color lookup table where the real RGB values reside. The use of a color lookup table takes significantly less memory but provides for fewer colors. Most 3D applications, and OpenGL in particular, operate using RGB colors because it is the natural color space for colors and lighting and shading. Color flashing will occur when you run OpenGL. When the focus shifts to an OpenGL window, either by clicking on it or by moving the mouse pointer to it, the way you have instructed X to change focus, the colors of the rest of the windows will change dramatically. When a non-OpenGL window is in focus, the colors in the OpenGL window will change.
  • 36. GLfloat myColour[3] = {0, 0, 1}; // blue glColor3fv( myColour ); // using vector of floats glColor3f(1.0, 0.0, 0.0); // red using floats glColor3ub(0, 255, 0); // green using unsigned bytes Assigning Colours Current drawing colour maintained as a state. Colour components - red, green, blue in range [0...1] as float or [0…255] as unsigned byte
  • 37. Colour Interpolation If desired, a polygon can be smoothly shaded to interpolate colours between vertices. This is accomplished by using the GL_SMOOTH shading mode (the OpenGL default) and by assigning a desired colour to each vertex.
  • 38. glShadeModel(GL_SMOOTH); // as opposed to GL_FLAT glBegin(GL_POLYGON); glColor3f(1.0, 0, 0 ); // red glVertex2d(0, 0); glColor3f(0, 0, 1.0 ); // blue glVertex2d(1, 0); glColor3f(0, 1.0, 0 ); // green glVertex2d(1, 1); glColor3f(1.0, 1.0, 1.0 ); // white glVertex2d(0, 1); glEnd();
  • 39. A fourth value called alpha is often appended to the colour vector. This can be used assign a desired level of transparency to a primitive and finds uses in compositing multiple images together. An alpha value of 0.0 defines an opaque colour, while an alpha value of 1.0 corresponds to complete transparency. The screen can be cleared to a particular colour as follows: glClearcolor(1.0, 1.0, 1.0, 0.0); // sets the clear colour to white and opaque glClear( GL_COLOR_BUFFER_BIT); // clears the colour frame buffer
  • 40. Lighting up the 3D World Ambient light (source at infinity) Diffuse light (from a point source) X Y Z X Y Z
  • 41. // Enable light glEnable(GL_LIGHT0); // can have other lights glEnable(GL_LIGHTING); glShadeModel(GL_SMOOTH); GLfloat light0_colour[] = {1, 1.0, 1, 1.0}; GLfloat light0_position[] = {0.0, 1.0, 0.0, 0.0}; // Setting up light type and position glLightfv(GL_LIGHT0, GL_AMBIENT, light0_colour); // use GL_DIFFUSE for diffuse glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
  • 42. Demo – 2D Curves
  • 43. Demo – 2D Polygon Drawing Polyline test Polygon test
  • 44. Demo – Colour Interpolation
  • 45. References • OpenGL Architecture Review Board, Dave Shreiner, Mason Woo, Jackie Neider, Tom Davis, OpenGL Architecture Review Board, The OpenGL Programming Guide – The Red book, 4th edition, Addison-Wesley. (http://www.glprogramming.com/red/ index.html) • OpenGL Architecture Review Board, Dave Shreiner, The OpenGL Reference Manual- The Blue book, 4th edition, Addison-Wesley. (http://rush3d.com/reference/opengl- bluebook-1.0) • F. S. Hill Jr., Computer Graphics using OpenGL, Pearson Education, 2003.
  • 46. End of Lectures on Graphics Programming using OpenGL