Computer Graphics CS 385 January 31, 2005. Fractals Some definitions Object which is self-similar at all scales. Regardless of scale the same level of.

Slides:



Advertisements
Similar presentations
Chapter 2: Graphics Programming
Advertisements

1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Programming with OpenGL Part 3: Three Dimensions.
OpenGL (Graphics Library) Software Interface to graphics software Allows to create interactive programs that produce color images of moving 3D objects.
Drawing Geometric Objects
OpenGL (I). What is OpenGL (OGL)? OGL is a 3D graphics & modeling library Can also use it to draw 2D objects.
CSC 461: Lecture 51 CSC461 Lecture 5: Simple OpenGL Program Objectives: Discuss a simple program Discuss a simple program Introduce the OpenGL program.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
1 Lecture 4 Graphical primitives Rasterization: algorithmic approach Rasterization: geometric approach 2D discrete lines, triangles Discrete planes 3D.
OpenGL and Projections
1 CSC461 Lecture 7: 3D Programming in OpenGL Objectives: Develop 2D and 3D examples -- Sierpinski gasket: a fractal Develop 2D and 3D examples -- Sierpinski.
ITEPC 06 - Workshop on Fractal Creation Chiew-Lan Tai and Oscar Au.
Computer Graphics CS 385 February 7, Fundamentals of OpenGl and Glut Today we will go through the basics of a minimal OpenGl Glut project, explaining.
Reference1. [OpenGL course slides by Rasmus Stenholt]
CS380 LAB I OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
CAP 4703 Computer Graphic Methods Prof. Roy Levow Lecture 2.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
Introduction to OpenGL and GLUT GLUT. What is OpenGL? An application programming interface (API) A (low-level) Graphics rendering API Generate high-quality.
Demetriou/Loizidou – ACSC330 – Chapter 2 Graphics Programming Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science Frederick Institute.
Graphics Programming Chapter 2. CS 480/680 2Chapter 2 -- Graphics Programming Introduction: Introduction: Our approach is programming oriented. Our approach.
State Management and Drawing Geometry Objects
Introduction to GL Geb Thomas. Example Code int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode ( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
DREAM PLAN IDEA IMPLEMENTATION Introduction to Computer Graphics Dr. Kourosh Kiani
P RACTICING O PEN GL- P RIMITIVES. O PEN GL O UTPUT P RIMITIVES  Each geometric object is described by a set of vertices and the type of primitive to.
1 Programming with OpenGL Part 3: Three Dimensions Yuanfeng Zhou Shandong University.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Programming with OpenGL Part 3: Three Dimensions.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Programming with OpenGL Review.
CS 480/680 Computer Graphics Programming with Open GL Part 6: Three Dimensions Dr. Frederick C Harris, Jr. Fall 2011.
Introduction to OpenGL and GLUT. What’s OpenGL? An Application Programming Interface (API) A low-level graphics programming API – Contains over 250 functions.
1 Chapter 2 Graphics Programming. 2 Using OpenGL in Visual C++ – 1/3 Opengl32.dll and glu32.dll should be in the system folder Opengl32.lib and glu32.lib.
NoufNaief.net TA: Nouf Al-harbi.
NoufNaief.net 1 TA: Nouf Al-Harbi.
Doç. Dr. Cemil Öz SAÜ Bilgisayar Mühendisliği Dr. Cemil Öz.
OpenGL Basic Drawing 2003 Spring Keng Shih-Ling
CS552: Computer Graphics Lecture 6: Viewing in 2D.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 3: Three Dimensions Ed Angel Professor of Computer Science,
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 6: Three Dimensions Ed Angel Professor.
31/1/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 2: Introduction.
OpenGL: Introduction #include main() { OpenWindow() ; glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0,
OpenGL Basic Drawing Jian-Liang Lin A Smidgen of OpenGL Code #include main() { InitializeAWindowPlease(); glClearColor (0.0, 0.0, 0.0, 0.0); glClear.
Introduction to Graphics Programming. Graphics API.
Graphics Graphics Korea University kucg.korea.ac.kr Graphics Programming 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
INTRODUCTION TO OPENGL
Computer Graphics -practical- Lecture 6. (visual c++) open gl library To use open GL with VC++ we add these files:- 1)Glut.h C:\program files\ Microsoft.
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
CSC Graphics Programming
Programming with OpenGL Part 2: Complete Programs
Materi Anatomi OpenGL Fungsi GLUT Posisi Kamera Proyeksi
Programming with OpenGL Part 3: Three Dimensions
OpenGL API 2D Graphic Primitives
Programming with OpenGL Part 2: Complete Programs
Graphics Programming (I)
OpenGL (Open Graphics Library) Mr. B.A.Swamy Assistant Professor Dept of CSE.
Lab 3 Geometric Drawing Lab 3 Geometric Drawing.
גרפיקה ממוחשבת: מבוא ל-OpenGL
Drawing in the plane 455.
Programming with OpenGL Part 3: Three Dimensions
Introduction to OpenGL
OpenGL program.
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 3: Three Dimensions
Programming with OpenGL Part 2: Complete Programs
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Programming with OpenGL Part 3: Three Dimensions
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Presentation transcript:

Computer Graphics CS 385 January 31, 2005

Fractals Some definitions Object which is self-similar at all scales. Regardless of scale the same level of detail and appearance is present A System having similar detail at all scales, leading to intricate patterns and unexpected features. A system with a non-integer dimension. Computer-generated images corresponding to mathematical equations, that repeat self-similar patterns at infinitely receding levels of organization.

The Mandelbrot Set

A Julia Set

The Sierpinski Gasket This object is defined recursively but its definition also has a random component. Nevertheless, the process always converges to a geometric object that looks the same. The theme here is: Order in Chaos

Non-Formal Description 1.Draw a triangle 2.Pick a point p in the triangle at random and draw it 3.Pick a vertex v of the triangle at random 4.Find the point q halfway between v and p 5.Go back to step 2 with q playing the role of p

Representing Points in OpenGL In OpenGL, a point is often called a vertex There is a family of functions that start out glVertex and can be used for various data types in either 2 or 3 dimensions.

Representing Points in OpenGL Examples of glVertex are glVertex2f and glVertex3i If the datatype is represented by the letter v, then this indicates that the function takes a pointer to an array as its argument.

#include void init(void) { glClearColor(1.0,1.0,1.0,1.0); glColor3f(0.0,0.0,0.0); } void display(void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POINTS); glVertex2f(0,0); glEnd(); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutCreateWindow(“A Point”); glutDisplayFunc(display); init(); glutMainLoop(); return 0; }

More Examples glBegin(GL_POINTS); glVertex2f(0,0); glEnd(); glBegin(GL_LINES); glVertex2f(0,0); glVertex2f(1,1); glEnd(); glBegin(GL_LINES); glVertex2f(1,1); glVertex2f(-1,-1); glVertex2f(-1,1); glVertex2f(1,-1); glEnd();

Back to the Sierpinski Gasket Whenever the window needs to be redrawn, the OpenGL engine calls a function specified by the function glutDisplayFunc This function takes a function which take a void argument and returns a void. By convention, the function is often called display. Lets look at an implementation of a display function for the Sierpinski Gasket

typedef GLfloat point2[2]; void display(void) { //Create an arbitrary triangle point2 vertices[3]={ {0.0, 0.0}, {250.0,500.0},{500.0,0.0}}; //Pick an arbitray point in the triangle static point2 p = {75.0, 50.0}; int j; for (int k=0; k<5000; k++) { j=rand()%3; //pick a random vertex from 0,1 and 2 //Compute the new point p[0] = (p[0] + vertices[j][0])/2; p[1] = (p[1] + vertices[j][1])/2; //Display the new point glBegin(GL_POINTS); glVertex2fv(p); glEnd(); } glFlush(); }

glBegin arguments GL_POINTS GL_LINES GL_LINE_STRIP GL_LINE_LOOP GL_TRIANGLES GL_TRIANGLE_STRIP GL_QUAD_STRIP GL_TRIANGLE_FAN

Next Monday Text Color and an Introduction to Viewing