Graphic Midterm
Graphic Midterm
1) Whats is opengl
- transform all 3d coordinates to 2d pixels that fit on screen -> rendering process
-software interface to graphics hardware
- allow to create interactive programs
2) What is opengl es - cross-platform api for rendering 2d and 3d graphics on mobile systems
3) Opengl pipeline ( traditional vs modern)
-fixed - function -programmable
Rendering process is controlled by a fixed Allows custom shader programs
sequence of operations ( by GPU hardware)
No flexibility High flexibility
All rendering stage executed automatically, Programmer have complete control over each
programmer no control rendering stage
2) Graphics processing unit (GPU) - a hardware to accelerate the creation of images in a frame buffer
for output
3) Rasterization - a rectangular pattern of parallel scanning lines followed by the electron beam on a
screen
Rasterization is the process of converting images or shapes into a grid of pixels for display on
a screen.
4) Vertex shader - is to transform the 3D coordinates of vertices from one space to another,
such as from object space to screen space.
5) Primitive assembly is the process of taking all vertices produced by the vertex shader and
grouping them into primitive shapes,
6) Clipping - improve performance by discarding any fragments (pixels) that fall outside
7) Fragment shader - to calculate the final colour of a pixel
8) Normalised device coordinates - all coordinates within -1.0 and 1.0 on (x,y,z) axis
9) Communication between cpu & gpu
-create memory
-specify how send data to graphics card
-create shader
-establish connection and configure how opengl interpret the memory
- associate with vertex array object (VAO)
Topic 2 drawing
Ordered Drawing Indexed Drawing
Define the coordinates of the vertices(real data) Define the indices of the vertices (not real data)
in counter-clockwise order in counter-clockwise order
Front facing user Can dereference them to obtain real data
Geometric Primitive
1) Point
2) Line segment
3) Triangle
4) Rectangle
5) Circle
6) sphere
Topic 3 opengl es
lifecycle
1) on create to executed when the system first creates the activity.
2) Onstart To make the activity visible and ready to interact.
3)
OnResume To set up functionality for when the component is visible and active.
4) OnPause
To pause or adjust operations that should be stopped or interrupted.
5) ONStop
To release or adjust resources not needed when the app is not visible.
6) OnDestroy to destroy the activity when it is finishing or due to configuration change.
7)
To use OpenGL ES in Android, you need an OpenGL surface view, which manages and
processes the OpenGL ES surface to render graphics into the Android view system.
8) The renderer in OpenGL ES is responsible for drawing shapes
9) The context in OpenGL ES keeps track of various state information that OpenGL ES needs to
know to render things to the screen.
Topic 4 shaders and the graphic pipeline
1) the attribute qualifier define input variables that are unique to each vertex.
2) The varying qualifier is pass data from a vertex shader to a fragment shader.
3) Uniform - global shader variable.
Topic 5 transformation
1) Transformation - an act of transition from something into something else
2) 2 main components being transformed
Geometric objects Coordinate system
2d/3d points and vectors alteration Coordinate systems alteration
GEOMETRIC TRANSFORMATION ( moving the VIEWING TRANSFORMATION (moving the
object instead of background) background instead of object)
- animation - view from different angle
-allow manipulation of individual objects - control the perspective
3) Hierarchical modelling of objects and scenes -> complex models are created from primitive(simple)
object using modelling transformations
// fragment shader
int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
glCompileShader(fragmentShader);
// vertex shader
int vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(vertexShader)
The app manifest in Android describes essential information about the app to the build tools,
The <uses-feature> declaration is used to inform external entities about the hardware and
software features
Refactoring Optimization
Refactoring simplifies code for easier understanding, while optimization
makes it run faster.
Both improve code readability and reduce complexity
A scene graph is a way to organize objects in a 3D scene. It's like a family tree where each
object has a parent and can have children. This helps manage and manipulate objects in the
scene efficiently.
A model's initializer sets up its vertex buffer, index buffer, and enables attributes. The render
function is used to draw the model on the screen.
Normalized Coordinates
NDC means x, y, and z are between -1.0 and 1.0.
Not visible.
Use projection transformation to convert camera coordinates to NDC.
Projection transformation allowing objects to appear larger when closer and smaller when
further away.
Wobbling illusion
Depth testing hidden surface removal