Chap 11. Raster Graphics in OpenGL. Chap 11. Raster Graphic in OpenGL2 Content Draw bitmap image Use bitmap fonts Draw color images Read and copy color.

Slides:



Advertisements
Similar presentations
©Zachary Wartell, UNCC9/28/ :30 AM 1 Overview of OpenGL Revision: 1.2 Copyright Professor Zachary Wartell, University of North Carolina All Rights.
Advertisements

Basic Raster Graphics Algorithms for Drawing 2D Primitives
Computer Graphics Tz-Huan Huang National Taiwan University (Slides are based on Prof. Chen’s)
Computing & Information Sciences Kansas State University CG Basics 5 of 8: OpenGL Primer 2 CIS 636/736: (Introduction to) Computer Graphics CIS 636 Introduction.
OpenGL Texture Mapping
Chapter 7. Imaging with openGL & 22 Presented by Garrett Yeh.
Buffers Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
OpenGL Basics Donghui Han. Assignment Grading Visual Studio Glut Files of four types needed: – Source code:.cpp,.h – Executable file:.exe (build in release.
Buffers Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Raster Displays Images are composed of arrays of pixels displayed on a raster device. Two main ways to create images: –Scan and digitize an existing image.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Introduction to OpenGL (Part 3) Ref: OpenGL Programming Guide (The Red Book)
CS 4731: Computer Graphics Lecture 21: Raster Graphics Part 2 Emmanuel Agu.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
OpenGL Pixel Operations, Bitmaps, Fonts and Images The Current Raster Position Current raster position: A position in window coordinates where the next.
Picking. What is picking? Selecting an object on the screen What does this require? –Get Mouse Location –Compute what objects are rendered at the position.
프로그래밍 기초와 실습 Chapter 7 Enumeration Types and typedef.
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
 Bitmap: A bitmap is a rectangular array of 0s and 1s that serves as a drawing mask for a corresponding rectangular portion of the window.  Applications:
Computer Graphics Texture Mapping Eriq Muhammad Adams
Tools for Raster Displays CVGLab Goals of the Chapter To describe pixmaps and useful operations on them. To develop tools for copying, scaling, and rotating.
Texture Mapping + Texture Object = Texture Mapped Object.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Speeding Up Rendering After Deciding What to Draw.
ECSE-4750 Computer Graphics Fall 2004 Prof. Michael Wozny TA. Abhishek Gattani TA. Stephen
Imaging and Raster Primitives Vicki Shreiner. 2 Jobs Andrew Giles Andrew Giles Chuck Fultz Chuck Fultz SIGGraph - SIGGraph.
2002 by Jim X. Chen: 1 So far, we only concerned with the rendering of geometric data. Two other important classes of data:
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
Lecture 4 Pixels, Images and Image Files 1. In this Lecture, you will learn the following concepts: Image files (in particular, the BMP file format) How.
Pixels, Images and Image Files 1 By Dr. HANY ELSALAMONY.
Texture Mapping in OpenGL. Texture Mapping Imaging we are “pasting” a picture onto a model  Which part of the picture will be pasted onto which part.
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
Discrete Techniques Chapter 7 Begun February 22, 2005 Finished April 26, 2005.
111/17/ :24 UML Solution Involves Selection of Discrete Representation Values.
2 COEN Computer Graphics I Evening’s Goals n Discuss displaying and reading image primitives n Describe texture mapping n Discuss OpenGL modes and.
CH8 Frame Buffer Object 1. Introduction Name OpenGL :Frame Buffer Object DirectX:Render Target Usage Render to Texture 2.
Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic Light Source.
OpenGL Programming Guide : Texture Mapping Yoo jin wook Korea Univ. Computer Graphics Lab.
영상 획득 영상 저장 카메라 파라메터 커스텀 이미지
Hallym University GVE LAB. 1 Graphics and Virtual Environment Laboratory 8 COLOR AND SHADING Palettes 를 중심으로 8 COLOR AND SHADING Palettes 를 중심으로.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Computer Graphics Bing-Yu Chen National Taiwan University.
Buffers Computer Graphics I, Fall 2010.
Graphics Output Primitives
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
Buffers. 2 Objectives Introduce additional OpenGL buffers Learn to read and write buffers Learn to use blending.
Drawing Pixel, Bitmap, Image. Bitmap Bitmap: Pixel 당 1 bit (0/1) 의 array Bitmap 색상 : bitmap 1 에 대응하는 frame buffer 의 색상은 현재 raster color 로 설정된다. bitmap.
Programming with Visual Studio MFC and OpenGL. Outline Creating a project Adding OpenGL initialization code and libraries Creating a mouse event Drawing.
Graphics OpenGL OpenGL Introduction 컴퓨터 그래픽스 김 창 헌.
The Framebuffer Hyun-Chul Cho. HyunChul Cho - KUCG -2 Buffer Goal of a graphics program Draw pictures on the screen Screen Rectangular array.
Tan-Chi Ho, CGGM Lab., CSIE of NCTU Pixel Operations and Buffers.
CS425 © 2003 Ray S. Babcock Pixels and Bitmaps ● OpenGL allows us to work directly with bits and groups of bits, or pixels, which flow down a parallel.
Texture Mapping CEng 477 Introduction to Computer Graphics.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
Chapter 8. Drawing Pixels, Bitmaps, Fonts, and Images Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
From VIC (VRVS) to ViEVO (EVO) 3 years of experiences with developing of video application VIC for VRVS allowed us to develop a new video application.
Buffers Ed Angel Professor Emeritus of Computer Science
Texture Mapping Fall, 2016.
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
OpenGL ARB Superbuffers
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Introduction to Computer Graphics with WebGL
Geb Thomas Adapted from the OpenGL Programming Guide
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Class 26 more textures environmental textures Color ramps
Introduction to Computer Graphics
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Computer Graphics Buffers
Buffers Ed Angel Professor Emeritus of Computer Science
Class 27 more textures environmental textures Color ramps
Presentation transcript:

Chap 11. Raster Graphics in OpenGL

Chap 11. Raster Graphic in OpenGL2 Content Draw bitmap image Use bitmap fonts Draw color images Read and copy color images on the screen Read and write Windows bitmap files

Chap 11. Raster Graphic in OpenGL3 Drawing Bitmaps(1/2) OpenGL 에서는 bitmap 을 그리기 위해 glBitmap 함수를 제공. glBitmap 의 첫번째 색깔 (0) 은 투명하고, 두번째 색깔 (1) 은 현재의 색과 빛 물질속성을 사용하여 그려짐. Bitmap 은 “Upside Down” 방식으로 아래에서 위방향으로 정의한다. Source Code1Program 1 Program 0

Chap 11. Raster Graphic in OpenGL4 Drawing Bitmaps(2/2) glRasterPos2i(int x, int y) : 좌표 (x,y) 에 raster 의 위치를 지정하고, raster position valid Flag 를 정한다. 이 Boolean 플래그는 raster 의 위치가 뷰포트 안쪽에 있다면 True 이고 바깥쪽이면 False 이다. glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bits) Program 3Source Code 2Program 2

Chap 11. Raster Graphic in OpenGL5 Bitmap Fonts 비트맵에서의 중요한 응용 프로그램 –Displaying character strings : 마이크로소프트 윈도우의 Win32 라이브러리에서 “wglUseFontBitmaps” 함수를 제공. OpenGL 에서 제공하는 함수 –glGenLists –glListBase –glCallLists Source Code 3 Source Code 4

Chap 11. Raster Graphic in OpenGL6 Building a simple Font library 기본적인 구성 –character set 을 결정 –Font 의 이름 – 문자의 스타일 부가적인 기능 –FontDelete –FontPuts –FontPrintf Source Code 5 Source Code 6 Source Code 7 Source Code 8 Program 4 Program 5

Chap 11. Raster Graphic in OpenGL7 Pixmaps : Bitmaps with Color(1/6) pixmaps : 두 가지 이상의 색을 가진 image. Background image 나 texture 로 사용된다. 일반적으로 OpenGL 에서는 8 비트 color index image 이거나 24 비트 RGB image 이다. glDrawPixels –glBitmap 과 같이, glDrawPixels 는 이미지의 bottom-left 를 정의하기 위하여 현재의 래스터 위치를 사용한다. –glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)

Chap 11. Raster Graphic in OpenGL8 Pixmaps : Bitmaps with Color(2/6) 형식설명 GL_COLOR_INDEX GL_LUMINANCE GL_RGB 컬러 인덱스 픽셀 그레이스케일 픽셀 RGB Pixel GL_BYTE GL_UNSIGNED_BYTE GL_BITMAP Signed 8 비트 값 Unsigned 8 비트 값 비트맵 이미지 형식설명 OpenGL 픽셀형 OpenGL 픽셀 포맷

Chap 11. Raster Graphic in OpenGL9 Pixmaps : Bitmaps with Color(3/6) glPixelMap 이나 glPixelTransfer 함수를 사용하여 pixmap 이나 비트맵내의 색을 remap 할 수 있다. glPixelTransfer : 색 인덱스와 RGB 값에 대한 스케일링과 옵셋을 지정. glPixelTransferref(GL_RED_SCALE, 1.1) glPixelTransferref(GL_GREEN_SCALE, 1.1); glPixelTransferref(GL_BLUE_SCALE, 1.1); 팔레트 엔트리로 비트맵의 컬러 인덱스를 지정하는 방식 glPixelTransferi(GL_INDEX_OFFSET, bitmap_entry) Source Code 9Program 6

Chap 11. Raster Graphic in OpenGL10 Pixmaps : Bitmaps with Color(4/6) Color Mapping Table –Lookup Table : 복잡한 이미지의 색 보정에 사용 (357page 의 그림 11-2 참조 ) Scaling a Pixmap –glPixelZoom 을 사용하여 pixmap 의 크기를 조절할 수 있음 –image 를 스케일하고 flip 할 수 있음 – 다른 비선형의 효과에 대하여, rippling water 나 perspective correction 에 대해서 Texture Mapping 을 사용 (12 장 ) Source Code 10Source Code 11

Chap 11. Raster Graphic in OpenGL11 Pixmaps : Bitmaps with Color(5/6) Panning a Pixmap –glPixelStore 함수를 이용하여 image 내부 pan 이 가능 Reading Pixmaps –glReadPixels 함수를 이용하여 화면에서 image 를 읽는 게 가능 –Texture mapping 으로 cool 효과를 위하여 사용될 수 있음 – 현재의 raster 위치를 무시하고 읽기 위하여 image 의 bottom- left 에 대한 view port 좌표지정이 필요 Source Code 12 Source Code 13

Chap 11. Raster Graphic in OpenGL12 Pixmaps : Bitmaps with Color(6/6) –View port array definitionsView port array definitions Copying Pixmaps – 화면상의 영역을 다른 위치로 복사하기 위한 함수 화면상의 영역을 다른 위치로 복사하기 위한 함수 –void glCopyPixels(Glint x, Glint y, Glsizei width, Glsizei height, Glenum type)void glCopyPixels(Glint x, Glint y, Glsizei width, Glsizei height, Glenum type) 0 View port 의 X 원점 1 View port 의 Y 원점 2 View port 의 X 크기 3 View port 의 Y 크기 IndexDescription Source Code 14

Chap 11. Raster Graphic in OpenGL13 A Bitmap File Viewer(1/3).BMP 파일의 특징 –Data 압축 체계를 이용하지 않아 OpenGL program 에서 사용하기 쉽다. – 사용된 color 의 형식에 따라 세개나 네개의 section 으로 구성..BMP 파일의 구성 BITMAPFILEHEADER BITMAPINFO Bitmap/Pixel Data RGB.BMP File BITMAPFILEHEADER BITMAPINFO PALETTEENTRYs Bitmap/Pixel Data Pallette.BMP File Definition

Chap 11. Raster Graphic in OpenGL14 A Bitmap File Viewer(2/3) Reading the.BMP File Writing the.BMP File LoadDIBitmap SaveDIBitmap

Chap 11. Raster Graphic in OpenGL15 A Bitmap File Viewer(3/3) PrintDIBitmap RepaintWindow OglViewer Printing the Bitmap Displaying the Bitmap 최종 Program

Chap 11. Raster Graphic in OpenGL16 Reference Section Frame buffer 에서 Pixel 의 사각형 block 을 복사 –glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); Frame buffer 에서 Pixel 의 사각형 block 을 그림 –glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const Glvoid *pixels) Pixel 전송을 위한 Lookup Table 을 정의 –glPixelMapfv(Glenum map, GLint mapsize, const GLfloat *values); –glPixelMapuiv(Glenum map, GLint mapsize, const GLuint *values); –glPixelMapusv(Glenum map, GLint mapsize, const GLushort *values);

Chap 11. Raster Graphic in OpenGL17 Reference Section Pixel 이 memory 에서 저장되고 읽히는 방법을 control –glPixelStorei(GLenum pname, GLint param); –glPixelStoref(GLenum pname, GLfloat param); glCopyPixels, glDrawPixels, glReadPixels, glTexImage1D, glTexImage2D 에 대한 Pixel 전송 모드와 옵션을 정한다. –glPixelTransferi(GLenum pname, GLint param); –glPixelTransferf(GLenum pname, GLfloat param); Pixel 전송을 위한 scaling 을 정한다. –glPixelZoom(GLfloat xfactor, GLfloat yfactor); Frame buffer 에서 Pixel 의 block 을 읽는다. –glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const Glvoid *pixels);

Chap 11. Raster Graphic in OpenGL18 감사합니다