CS0045 Module 1

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/66

encourage image

There's no tags or description

Looks like no tags are added yet.

67 Terms

1
New cards

A computer graphics rendering application programming interface

OpenGL

2
New cards

API

Application Programming Interface

3
New cards

With it, you can generate high-quality color images by rendering with geometric and image primitives

OpenGL

4
New cards

It forms the basis of many interactive applications that include 3D graphics

OpenGL

5
New cards

By using OpenGL, the graphics part of your application can be:

• operating system independent

• window system independent

6
New cards

First Developed at Silicon Graphics (SGI) Computer Systems

OpenGL

7
New cards

OpenGL was First Developed at __ __ (__) __ __

Silicon Graphics (SGI) Computer Systems

8
New cards

OpenGL Version 1.0 (__)

1994

9
New cards

Client-Server Model

• Application (Client)

• Server (Vendor OpenGL implementation)

OpenGL

10
New cards

It's not Object-Oriented

OpenGL

11
New cards

Refers to the collection of open, royalty-free standards developed and managed by The Khronos Group, an industry consortium

Khronos Visual Computing Ecosystem

12
New cards

These standards aim to enable hardware acceleration and cross-platform compatibility for a wide range of visual computing applications, including 3D graphics, parallel computing, virtual and augmented reality, neural networks, and computer vision

Khronos Visual Computing Ecosystem

13
New cards

Desktop, Mobile, Web Embedded and Safety Critical

3D Graphics

14
New cards

• Vulkan

• ANARI

• OpenGL ES

• OpenGL

• WebGL

• EGL

• OpenGL SC

• Vulkan SC

• OpenVG

3D Graphics

15
New cards

Authoring and Delivery

3D Assets

16
New cards

• glTF

• COLLADA

• 3DCommerce

3D Assets

17
New cards

Augmented and Virtual Reality

Portable XR

18
New cards

• OpenXR

Portable XR

19
New cards

Vision, Inferencing, Machine Learning

Parallel Computation

20
New cards

• SPIR

• OpenCL

• SYCL

• NNEF

• OpenVX

Parallel Computation

21
New cards

Latest version is 4.5

OpenGL

22
New cards

A sequence of stages that processes 3D scene data to produce a 2D image displayed on the screen

OpenGL Rendering Pipeline

23
New cards

This pipeline can be broadly categorized into fixed- function stages, which are controlled by OpenGL, and programmable stages, where developers can write custom code called shaders

OpenGL Rendering Pipeline

24
New cards

Like the engine of graphics programming

OpenGL Rendering Pipeline

25
New cards

It enables the following:

• Turns complex 3D data into 2D images fast, thanks to the GPU

• Allows developers customize visuals with shaders for unique effects

• Saves time by skipping unnecessary work (like clipping off- screen objects)

OpenGL Rendering Pipeline

26
New cards

Turns complex 3D data into 2D images fast, thanks to the GPU

Why the OpenGL Rendering Pipeline Matters

27
New cards

Allows developers customize visuals with shaders for unique effects

Why the OpenGL Rendering Pipeline Matters

28
New cards

Saves time by skipping unnecessary work (like clipping off- screen objects)

Why the OpenGL Rendering Pipeline Matters

29
New cards
<p>OpenGL Rendering Pipeline:</p>

OpenGL Rendering Pipeline:

• Vertex Specification

• Vertex Shader

• Tessellation

• Geometry Shader

• Vertex Post-Processing

• Primitive Assembly

• Rasterization

• Fragment Shader

• Per-Sample Operations

30
New cards

This initial stage involves defining and organizing the raw vertex data (positions, colors, texture coordinates, normals, etc.) in memory, typically using Vertex Buffer Objects (VBOs) and Vertex Array Objects (VAOs)

Vertex Specification

31
New cards

This initial stage (Vertex Specification) involves defining and organizing the raw vertex data (positions, colors, texture coordinates, normals, etc.) in memory, typically using __ __ __ (__) and __ __ __ (__)

Vertex Buffer Objects (VBOs) and Vertex Array Objects (VAOs)

32
New cards

This is the first programmable stage

Vertex Shader

33
New cards

Processes each vertex individually, performing transformations (like model-view-projection), lighting calculations, and passing data to subsequent stages

Vertex Shader

34
New cards

After vertex processing, vertices are assembled into primitives like points, lines, or triangles, based on the specified drawing mode

Primitive Assembly

35
New cards

This programmable stage can generate new primitives or modify existing ones based on the input primitives

Geometry Shader (Optional)

36
New cards

It's useful for advanced effects like tessellation or procedural geometry generation

Geometry Shader (Optional)

37
New cards

This fixed-function stage converts the geometric primitives into fragments, which are essentially potential pixels on the screen

Rasterization

38
New cards

It also performs clipping, discarding parts of primitives outside the viewing frustum

Rasterization

39
New cards

This is another programmable stage where each fragment's final color is determined

Fragment Shader

40
New cards

It can perform complex lighting, texturing, and other per-pixel calculations

Fragment Shader

41
New cards

This fixed-function stage includes various tests and operations on the fragments, such as depth testing (to determine visibility), stencil testing, blending (for transparency), and scissoring, before the final color is written to the framebuffer

Per-Sample Operations

42
New cards

OpenGL Requirements:

• Visual Studio Code

• VS Code C/C++ Extension (C/C++ — Microsoft)

• MSYS2

• MSYS2 UCRT64 GCC

• FreeGLUT

• Windows OpenGL/GLU libraries

43
New cards

C++ source-code editor and debugger

Visual Studio Code

44
New cards

IntelliSense, compilation integration, debugging

VS Code C/C++ Extension (C/C++ — Microsoft)

45
New cards

Windows development environment and package manager

MSYS2

46
New cards

C/C++ compiler and toolchain

MSYS2 UCRT64 GCC

47
New cards

OpenGL window/context and GLUT functions

FreeGLUT

48
New cards

OpenGL functionality provided by Windows

Windows OpenGL/GLU libraries

49
New cards

For this course, use the __ __ toolchain consistently

MSYS2 UCRT64

50
New cards

Save (Shortcut)

Ctrl + S

51
New cards

Compile active .cpp (Shortcut)

Ctrl + Shift + B

52
New cards

Compile + Run/Debug (Shortcut)

F5

53
New cards

Stop running program (Shortcut)

Shift + F5

54
New cards

Open Terminal (Shortcut)

Ctrl + `

55
New cards

Command Palette (Shortcut)

Ctrl + Shift + P

56
New cards
#include <GL/glut.h>

using namespace std;

void display(){
    glClear(GL_COLOR_BUFFER_BIT);

    glBegin(GL_POLYGON);
        glVertex2f(-0.5, -0.5);
        glVertex2f(-0.5, 0.5);
        glVertex2f(0.5, 0.5);
        glVertex2f(0.5, -0.5);   
    glEnd();
    glFlush();
}

int main(int argc, char** argv){
    glutInit(&argc, argv);
    glutCreateWindow("simple");
    glutDisplayFunc(display);

    glutMainLoop();

return 0;
} 


Output

<p>Output</p>
57
New cards
<pre><code class="language-cpp">glutInit(&amp;argc, argv);</code></pre><p></p>
glutInit(&argc, argv);


Initializes GLUT and should be called before other GLUT and OpenGL functions

58
New cards
<pre><code class="language-cpp">glutCreateWindow("simple");</code></pre><p></p>
glutCreateWindow("simple");


Creates a window on the screen with the title given by the argument

59
New cards
<pre><code class="language-cpp">glutDisplayFunc(display);</code></pre><p></p>
glutDisplayFunc(display);


• The function display() is called each time the window needs to be redrawn (pointer to a function)

• display() --- callback function. Global variables may be necessary to pass values among functions

60
New cards
<p></p><pre><code class="language-cpp">glutMainLoop();</code></pre><p></p>


glutMainLoop();


Causes the program to enter an infinite event-processing loop. It should be the last statement in the main() function.

61
New cards
<pre><code class="language-cpp">void display(){

    glClear(GL_COLOR_BUFFER_BIT);

    glBegin(GL_POLYGON);

        glVertex2f(-0.5f, -0.5f);
        glVertex2f(-0.5f, 0.5f);
        glVertex2f(0.5f, 0.5f);
        glVertex2f(0.5f, -0.5f);   

    glEnd();
    glFlush();
}</code></pre><p></p>
void display(){

    glClear(GL_COLOR_BUFFER_BIT);

    glBegin(GL_POLYGON);

        glVertex2f(-0.5f, -0.5f);
        glVertex2f(-0.5f, 0.5f);
        glVertex2f(0.5f, 0.5f);
        glVertex2f(0.5f, -0.5f);   

    glEnd();
    glFlush();
}


The OpenGL Coordinate System

62
New cards
<pre><code class="language-cpp">glVertex(234)(sfid)</code></pre><p></p>
glVertex(234)(sfid)


Specifies the location of the vertex

63
New cards
<pre><code class="language-cpp">glBegin(Glenum mode)</code></pre><p></p>
glBegin(Glenum mode)


Specifies the beginning of an object of type mode. Modes include GL_POINTS, GL_LINES, and GL_POLYGON

64
New cards
<pre><code class="language-cpp">glEnd()</code></pre><p></p>
glEnd()


Specifies the end of a list of vertices

65
New cards
<pre><code class="language-cpp">glClear(Glbitfield mask)</code></pre><p></p>
glClear(Glbitfield mask)


Clears all buffers whose bits are set in mask. GL_COLOR_BUFFER_BIT refers to the color buffer

66
New cards
<pre><code class="language-cpp">glFlush()</code></pre><p></p>
glFlush()


Forces previously buffered OpenGL commands to execute

67
New cards

Changing the GLUT Defaults

• glutInitWindowSize(1024, 768);

• glutInitWindowPosition(0, 0);