SlideShare a Scribd company logo
GRAFIKA KOMPUTER
OpenGL Math
Cartesian Coordinate in Real World
• Setiap titik ditentukan
lokasinya melalui pasangan
nilai x dan y
• Nilai koordinat x bertambah
positif dari kiri ke kanan dan
nilai y bertambah positif dari
bawah ke atas
(0,0)
Sumbuy Sumbu x
(3,5)
OpenGL Right Handed Coordinates
koordinat cartesian digambar
ulang ke layar komputer maka
secara visual lokasi titik tersebut
akan berubah
Cartesian Coordinate on Your Screen
(0,0)
Sumbuy
Sumbu x
(3,5)
We use 4 sets of OpenGL Libraries
• Core OpenGL (GL)
• OpenGL Utility Library (GLU)
• OpenGL Utility Library Toolkit (GLUT)
• OpenGL Extension Wrangler Library (GLEW)
Core OpenGL
consists of hundreds of commands, which begin with a prefix "gl"
(e.g., glColor, glVertex, glTranslate, glRotate). The Core OpenGL
models an object via a set of geometric primitives such as point, line
and polygon.
GLU
built on‐top of the core OpenGL to provide important utilities (such as
setting camera view and projection) and more building models (such
as qradric surfaces and polygon tessellation). GLU commands start
with a prefix "glu" (e.g., gluLookAt, gluPerspective).
GLUT
GLUT is designed for constructing small to medium sized OpenGL
programs. While GLUT is well‐suited to learning OpenGL and
developing simple OpenGL applications, GLUT is not a full‐featured
toolkit so large applications requiring sophisticated user interfaces are
better off using native window system toolkits. GLUT is simple, easy,
and small.
OpenGL is designed to be independent of the windowing system or
operating system. GLUT is needed to interact with the Operating
System (such as creating a window, handling key and mouse inputs);
it also provides more building models (such as sphere and torus).
GLUT commands start with a prefix of "glut" (e.g., glutCreatewindow,
glutMouseFunc). GLUT is platform independent, which is built on top
of platform‐specific OpenGL extension such as GLX for X Window
System, WGL for Microsoft Window, and AGL, CGL or Cocoa for
Mac OS.
GLEW
GLEW is a cross‐platform open‐source C/C++ extension loading
library. GLEW provides efficient run‐time mechanisms for determining
which OpenGL extensions are supported on the target platform.
Parameter
Specifies the primitive or primitives that will be created from vertices
presented between glBegin and the subsequent glEnd. Ten symbolic
constants are accepted:
GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP,
GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN,
GL_QUADS, GL_QUAD_STRIP, GL_POLYGON
Example
glBegin(GL_POLYGON);
……..
glEnd();
Clearing
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
……..
glEnd();
glFlush();
Pixels are stored in bitplanes, so clear it once you were done
What’s that for?
GL_COLOR_BUFFER_BIT
Performs the clear operation on one or more buffers at the same time
glFlush()
Forces execution before the gathering is complete
Colors in OpenGL
OpenGL use a RGB Color Model
RGB stands for the colors red, green and blue: the additive primary
colors. Each of these colors is given a value, in OpenGL usually a
value between 0 and 1. 1 means as much of that color as possible,
and 0 means none of that color. We can mix these three colors
together to give us a complete range of colors, as shown to on the
left.
https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml
Example
glColor3f(0.5f, 0.0f, 1.0f); // (0.5, 0, 1) is
half red and full blue, giving dark purple.
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(0.5f, 0.0f, 1.0f); // purple
glVertex2f(-0.75, 0.75);
glColor3f(1.0f, 0.0f, 0.0f); // red
glVertex2f(-0.75, -0.75);
glColor3f(0.0f, 1.0f, 0.0f); // green
glVertex2f(0.75, -0.75);
glColor3f(1.0f, 1.0f, 0.0f); // yellow
glVertex2f(0.75, 0.75);
glEnd();
glFlush();
}
Mixed Color in RGB
• glColor3f (0.0, 0.0, 0.0) Black
• glColor3f (1.0, 0.0, 0.0) Red
• glColor3f (1.0, 1.0, 0.0) Yellow
• glColor3f (0.0, 1.0, 0.0) Green
• glColor3f (0.0, 1.0, 1.0) Cyan
• glColor3f (0.0, 0.0, 1.0) Blue
• glColor3f (1.0, 0.0, 1.0) Magenta
• glColor3f (1.0, 1.0, 1.0) White
• glColor3f (0.5, 0.5, 0.5) Gray
http://prideout.net/archive/colors.php
Linear Mapping Color
Color hack mapping: x/R
R = 255 Colors
x = Color’s Mapping Number
Drawing Primitives
glVertex*() : Specifies vertex coordinates
Example:
glVertex2f(): Specifies vertex coordinates on 2 axis (float)
glVertex3f(): Specifies vertex coordinates on 3 axis (float)
https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml
void displayMe(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(0.0, 0.0);
glVertex2f(0.5, 0.0);
glVertex2f(0.5, 0.5);
glVertex2f(0.0, 0.5); glEnd();
glFlush();
}
Tugas Kelompok
Kelompok 1 : API Grafis
Kelompok 2 : Kordinat Kartesian 2 Axis
Kelompok 3 : Perangkat Input Grafis
Kelompok 4 : Perangkat Output Grafis
Kelompok 5 : Kordinat Kartesian 3 Axis
Kelompok 6 : GLUT
Kelompok 7 : RGB Color
Kelompok 8 : Bangun Datar Primitif
The Rules are
• Presentasi dalam Bahasa inggris
• Desain presentasi menarik dan mudah dibaca
• Presentasi dikumpul paling lambat tanggal 28 Maret 2017 pukul 23:00
di nurfadliutomo@outlook.com, dan dipresentasikan pada tanggal 30
maret
• Telat kumpul dianggap gugur atau tidak mendapat nilai
• Plagiat dianggap gugur
• Rekomendasi sumber harus kredibel, seperti dokumentasi software, jurnal,
pendapat ahli, dan wiki (blog bisa diambil dan isinya harus bisa
dipertanggungjawabkan oleh presenter apabila hasilnya tidak sesuai)
Kasih
Terima

More Related Content

Similar to Grafika komputer 2

Development with OpenGL and Qt
Development with OpenGL and QtDevelopment with OpenGL and Qt
Development with OpenGL and Qt
Ronny Yabar Aizcorbe
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
NatsuDragoneel5
 
Open gles
Open glesOpen gles
Open gles
sarmisthadas
 
Computer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptxComputer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptx
AnandM62785
 
Opengl (1)
Opengl (1)Opengl (1)
Opengl (1)
ch samaram
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
René Domínguez
 
september11.ppt
september11.pptseptember11.ppt
september11.ppt
CharlesMatu2
 
Bai 1
Bai 1Bai 1
Open gl
Open glOpen gl
Open gl
ch samaram
 
01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt
EngrZamaan
 
Hill ch2ed3
Hill ch2ed3Hill ch2ed3
Hill ch2ed3
Kunal Verma
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
Gulnaz Akhter
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
Gulnaz Akhter
 
opengl.ppt
opengl.pptopengl.ppt
opengl.ppt
Subiksha57
 
Intro to Computer Graphics.ppt
Intro to Computer Graphics.pptIntro to Computer Graphics.ppt
Intro to Computer Graphics.ppt
adil104135
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
Gulnaz Akhter
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
Gulnaz Akhter
 
Open gl polygon code review
Open gl polygon code reviewOpen gl polygon code review
Open gl polygon code review
SANURI KARUNARATHNA
 
Richard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleRichard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL Module
Axway Appcelerator
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
pushpa latha
 

Similar to Grafika komputer 2 (20)

Development with OpenGL and Qt
Development with OpenGL and QtDevelopment with OpenGL and Qt
Development with OpenGL and Qt
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
 
Open gles
Open glesOpen gles
Open gles
 
Computer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptxComputer Graphics with OpenGL presentation Slides.pptx
Computer Graphics with OpenGL presentation Slides.pptx
 
Opengl (1)
Opengl (1)Opengl (1)
Opengl (1)
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
 
september11.ppt
september11.pptseptember11.ppt
september11.ppt
 
Bai 1
Bai 1Bai 1
Bai 1
 
Open gl
Open glOpen gl
Open gl
 
01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt
 
Hill ch2ed3
Hill ch2ed3Hill ch2ed3
Hill ch2ed3
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
opengl.ppt
opengl.pptopengl.ppt
opengl.ppt
 
Intro to Computer Graphics.ppt
Intro to Computer Graphics.pptIntro to Computer Graphics.ppt
Intro to Computer Graphics.ppt
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
Open gl polygon code review
Open gl polygon code reviewOpen gl polygon code review
Open gl polygon code review
 
Richard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleRichard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL Module
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
 

More from Nur Fadli Utomo

Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan SessionPemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan Session
Nur Fadli Utomo
 
Pemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQLPemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQL
Nur Fadli Utomo
 
Desain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web ApplicationDesain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web Application
Nur Fadli Utomo
 
Pemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHPPemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHP
Nur Fadli Utomo
 
Pemrograman Web 6 - jQuery
Pemrograman Web 6 - jQueryPemrograman Web 6 - jQuery
Pemrograman Web 6 - jQuery
Nur Fadli Utomo
 
Pemrograman Web 5 - Javascript
Pemrograman Web 5 - JavascriptPemrograman Web 5 - Javascript
Pemrograman Web 5 - Javascript
Nur Fadli Utomo
 
Desain Grafis 5 - Good Graphic Design
Desain Grafis 5 - Good Graphic DesignDesain Grafis 5 - Good Graphic Design
Desain Grafis 5 - Good Graphic Design
Nur Fadli Utomo
 
Desain Grafis 3 - Color
Desain Grafis 3 - ColorDesain Grafis 3 - Color
Desain Grafis 3 - Color
Nur Fadli Utomo
 
Desain Grafis 4 - UI/UX
Desain Grafis 4 - UI/UXDesain Grafis 4 - UI/UX
Desain Grafis 4 - UI/UX
Nur Fadli Utomo
 
Pemrograman Web 4 - Bootstrap 3
Pemrograman Web 4 - Bootstrap 3Pemrograman Web 4 - Bootstrap 3
Pemrograman Web 4 - Bootstrap 3
Nur Fadli Utomo
 
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2
Nur Fadli Utomo
 
Desain Grafis 2 - Kerning Type
Desain Grafis 2 - Kerning TypeDesain Grafis 2 - Kerning Type
Desain Grafis 2 - Kerning Type
Nur Fadli Utomo
 
Desain Grafis 1 - Basic
Desain Grafis 1 - BasicDesain Grafis 1 - Basic
Desain Grafis 1 - Basic
Nur Fadli Utomo
 
Pemrograman Web 2 - CSS
Pemrograman Web 2 - CSSPemrograman Web 2 - CSS
Pemrograman Web 2 - CSS
Nur Fadli Utomo
 
Pemrograman Web - HTML
Pemrograman Web - HTMLPemrograman Web - HTML
Pemrograman Web - HTML
Nur Fadli Utomo
 
PC 9 - Matlab 2nd Chapter
PC 9 - Matlab 2nd ChapterPC 9 - Matlab 2nd Chapter
PC 9 - Matlab 2nd Chapter
Nur Fadli Utomo
 
PC 8 - Matlab
PC 8 - MatlabPC 8 - Matlab
PC 8 - Matlab
Nur Fadli Utomo
 
Pengolahan Citra 7 - Warna
Pengolahan Citra 7 - WarnaPengolahan Citra 7 - Warna
Pengolahan Citra 7 - Warna
Nur Fadli Utomo
 
GK 3 Penggambaran Titik dan Garis
GK 3   Penggambaran Titik dan GarisGK 3   Penggambaran Titik dan Garis
GK 3 Penggambaran Titik dan Garis
Nur Fadli Utomo
 
Citra Biner
Citra BinerCitra Biner
Citra Biner
Nur Fadli Utomo
 

More from Nur Fadli Utomo (20)

Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan SessionPemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan Session
 
Pemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQLPemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQL
 
Desain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web ApplicationDesain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web Application
 
Pemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHPPemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHP
 
Pemrograman Web 6 - jQuery
Pemrograman Web 6 - jQueryPemrograman Web 6 - jQuery
Pemrograman Web 6 - jQuery
 
Pemrograman Web 5 - Javascript
Pemrograman Web 5 - JavascriptPemrograman Web 5 - Javascript
Pemrograman Web 5 - Javascript
 
Desain Grafis 5 - Good Graphic Design
Desain Grafis 5 - Good Graphic DesignDesain Grafis 5 - Good Graphic Design
Desain Grafis 5 - Good Graphic Design
 
Desain Grafis 3 - Color
Desain Grafis 3 - ColorDesain Grafis 3 - Color
Desain Grafis 3 - Color
 
Desain Grafis 4 - UI/UX
Desain Grafis 4 - UI/UXDesain Grafis 4 - UI/UX
Desain Grafis 4 - UI/UX
 
Pemrograman Web 4 - Bootstrap 3
Pemrograman Web 4 - Bootstrap 3Pemrograman Web 4 - Bootstrap 3
Pemrograman Web 4 - Bootstrap 3
 
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2
 
Desain Grafis 2 - Kerning Type
Desain Grafis 2 - Kerning TypeDesain Grafis 2 - Kerning Type
Desain Grafis 2 - Kerning Type
 
Desain Grafis 1 - Basic
Desain Grafis 1 - BasicDesain Grafis 1 - Basic
Desain Grafis 1 - Basic
 
Pemrograman Web 2 - CSS
Pemrograman Web 2 - CSSPemrograman Web 2 - CSS
Pemrograman Web 2 - CSS
 
Pemrograman Web - HTML
Pemrograman Web - HTMLPemrograman Web - HTML
Pemrograman Web - HTML
 
PC 9 - Matlab 2nd Chapter
PC 9 - Matlab 2nd ChapterPC 9 - Matlab 2nd Chapter
PC 9 - Matlab 2nd Chapter
 
PC 8 - Matlab
PC 8 - MatlabPC 8 - Matlab
PC 8 - Matlab
 
Pengolahan Citra 7 - Warna
Pengolahan Citra 7 - WarnaPengolahan Citra 7 - Warna
Pengolahan Citra 7 - Warna
 
GK 3 Penggambaran Titik dan Garis
GK 3   Penggambaran Titik dan GarisGK 3   Penggambaran Titik dan Garis
GK 3 Penggambaran Titik dan Garis
 
Citra Biner
Citra BinerCitra Biner
Citra Biner
 

Recently uploaded

Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
ImMuslim
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
IsmaelVazquez38
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
Nguyen Thanh Tu Collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
Nguyen Thanh Tu Collection
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 

Recently uploaded (20)

Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 

Grafika komputer 2

  • 2.
  • 3. Cartesian Coordinate in Real World • Setiap titik ditentukan lokasinya melalui pasangan nilai x dan y • Nilai koordinat x bertambah positif dari kiri ke kanan dan nilai y bertambah positif dari bawah ke atas (0,0) Sumbuy Sumbu x (3,5)
  • 4. OpenGL Right Handed Coordinates
  • 5. koordinat cartesian digambar ulang ke layar komputer maka secara visual lokasi titik tersebut akan berubah Cartesian Coordinate on Your Screen (0,0) Sumbuy Sumbu x (3,5)
  • 6. We use 4 sets of OpenGL Libraries • Core OpenGL (GL) • OpenGL Utility Library (GLU) • OpenGL Utility Library Toolkit (GLUT) • OpenGL Extension Wrangler Library (GLEW)
  • 7. Core OpenGL consists of hundreds of commands, which begin with a prefix "gl" (e.g., glColor, glVertex, glTranslate, glRotate). The Core OpenGL models an object via a set of geometric primitives such as point, line and polygon.
  • 8. GLU built on‐top of the core OpenGL to provide important utilities (such as setting camera view and projection) and more building models (such as qradric surfaces and polygon tessellation). GLU commands start with a prefix "glu" (e.g., gluLookAt, gluPerspective).
  • 9. GLUT GLUT is designed for constructing small to medium sized OpenGL programs. While GLUT is well‐suited to learning OpenGL and developing simple OpenGL applications, GLUT is not a full‐featured toolkit so large applications requiring sophisticated user interfaces are better off using native window system toolkits. GLUT is simple, easy, and small.
  • 10. OpenGL is designed to be independent of the windowing system or operating system. GLUT is needed to interact with the Operating System (such as creating a window, handling key and mouse inputs); it also provides more building models (such as sphere and torus). GLUT commands start with a prefix of "glut" (e.g., glutCreatewindow, glutMouseFunc). GLUT is platform independent, which is built on top of platform‐specific OpenGL extension such as GLX for X Window System, WGL for Microsoft Window, and AGL, CGL or Cocoa for Mac OS.
  • 11. GLEW GLEW is a cross‐platform open‐source C/C++ extension loading library. GLEW provides efficient run‐time mechanisms for determining which OpenGL extensions are supported on the target platform.
  • 12. Parameter Specifies the primitive or primitives that will be created from vertices presented between glBegin and the subsequent glEnd. Ten symbolic constants are accepted: GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, GL_POLYGON
  • 15. What’s that for? GL_COLOR_BUFFER_BIT Performs the clear operation on one or more buffers at the same time glFlush() Forces execution before the gathering is complete
  • 16. Colors in OpenGL OpenGL use a RGB Color Model RGB stands for the colors red, green and blue: the additive primary colors. Each of these colors is given a value, in OpenGL usually a value between 0 and 1. 1 means as much of that color as possible, and 0 means none of that color. We can mix these three colors together to give us a complete range of colors, as shown to on the left. https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml
  • 17. Example glColor3f(0.5f, 0.0f, 1.0f); // (0.5, 0, 1) is half red and full blue, giving dark purple.
  • 18. void display() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_QUADS); glColor3f(0.5f, 0.0f, 1.0f); // purple glVertex2f(-0.75, 0.75); glColor3f(1.0f, 0.0f, 0.0f); // red glVertex2f(-0.75, -0.75); glColor3f(0.0f, 1.0f, 0.0f); // green glVertex2f(0.75, -0.75); glColor3f(1.0f, 1.0f, 0.0f); // yellow glVertex2f(0.75, 0.75); glEnd(); glFlush(); }
  • 19. Mixed Color in RGB • glColor3f (0.0, 0.0, 0.0) Black • glColor3f (1.0, 0.0, 0.0) Red • glColor3f (1.0, 1.0, 0.0) Yellow • glColor3f (0.0, 1.0, 0.0) Green • glColor3f (0.0, 1.0, 1.0) Cyan • glColor3f (0.0, 0.0, 1.0) Blue • glColor3f (1.0, 0.0, 1.0) Magenta • glColor3f (1.0, 1.0, 1.0) White • glColor3f (0.5, 0.5, 0.5) Gray http://prideout.net/archive/colors.php
  • 20. Linear Mapping Color Color hack mapping: x/R R = 255 Colors x = Color’s Mapping Number
  • 21. Drawing Primitives glVertex*() : Specifies vertex coordinates Example: glVertex2f(): Specifies vertex coordinates on 2 axis (float) glVertex3f(): Specifies vertex coordinates on 3 axis (float) https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml
  • 22. void displayMe(void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glVertex2f(0.0, 0.0); glVertex2f(0.5, 0.0); glVertex2f(0.5, 0.5); glVertex2f(0.0, 0.5); glEnd(); glFlush(); }
  • 23. Tugas Kelompok Kelompok 1 : API Grafis Kelompok 2 : Kordinat Kartesian 2 Axis Kelompok 3 : Perangkat Input Grafis Kelompok 4 : Perangkat Output Grafis Kelompok 5 : Kordinat Kartesian 3 Axis Kelompok 6 : GLUT Kelompok 7 : RGB Color Kelompok 8 : Bangun Datar Primitif
  • 24. The Rules are • Presentasi dalam Bahasa inggris • Desain presentasi menarik dan mudah dibaca • Presentasi dikumpul paling lambat tanggal 28 Maret 2017 pukul 23:00 di nurfadliutomo@outlook.com, dan dipresentasikan pada tanggal 30 maret • Telat kumpul dianggap gugur atau tidak mendapat nilai • Plagiat dianggap gugur • Rekomendasi sumber harus kredibel, seperti dokumentasi software, jurnal, pendapat ahli, dan wiki (blog bisa diambil dan isinya harus bisa dipertanggungjawabkan oleh presenter apabila hasilnya tidak sesuai)