The document is a slide presentation about computer graphics and OpenGL. It introduces the graphics pipeline, discusses concepts like transformations and coordinate frames in OpenGL, and provides an example OpenGL ES application for iOS that renders a teapot with lighting effects. Key points covered include the graphics pipeline stages of modeling, posing, rendering and rasterization, using transformation matrices for positioning objects, and how OpenGL handles rendering through functions like glPushMatrix and glDrawElements.
As a powerful framework, Qt offers tons of modules and classes for building your applications. This talk highlight few practical cross-platform examples of what Qt can do with a fairly few lines of code, ranging from kinetic scrolling, weather service, OpenStreetMap, parallax effect, flight tracking, WYSIWYG HTML editor, and many more. All examples will be accompanied with corresponding live demos.
Presentation by Ariya Hidayat held during the Maemo Summit 2009 in Amsterdam
Modern applications are more and more moving away from static forms. In a modern interface, widgets and graphical elements are animated and transitioned smoothly. Those effects make your application look good but their main purpose should be to help end-users find out what's going on in their applications. In upcoming Qt versions we’re adding a new Animation Framework that relies upon Qt’s QObject-based architecture.
Presentation by Thierry Bastian held during Qt Developer Days 2009.
http://qt.nokia.com/developer/learning/elearning
As a powerful framework, Qt offers tons of modules and classes for building your applications. This talk highlight few practical cross-platform examples of what Qt can do with a fairly few lines of code, ranging from kinetic scrolling, weather service, OpenStreetMap, parallax effect, flight tracking, WYSIWYG HTML editor, and many more. All examples will be accompanied with corresponding live demos.
Presentation by Ariya Hidayat held during the Maemo Summit 2009 in Amsterdam
Modern applications are more and more moving away from static forms. In a modern interface, widgets and graphical elements are animated and transitioned smoothly. Those effects make your application look good but their main purpose should be to help end-users find out what's going on in their applications. In upcoming Qt versions we’re adding a new Animation Framework that relies upon Qt’s QObject-based architecture.
Presentation by Thierry Bastian held during Qt Developer Days 2009.
http://qt.nokia.com/developer/learning/elearning
Interacting with the Qt Quick scene graph is a good bonus skill for any Qt developer to have. In this introductory webinar we will present this component: a graphical representation of the Item scene and an alternative method to QML coding. Proper use of the underlying scene graph can save performance at runtime. We will explore how to interact with the scene graph through a simple example and suggest when it is appropriate to use.
The game API is one of the most interesting and unique concepts of Java ME. It consists of very useful classes that help you with typical tasks that are required in almost ever game — for example sprite handling, tiled backgrounds or collision detection. This module will explain those concepts and how to create an own game loop. The challenge is the largest project yet and involves writing your own game called "Schlabo". The player moves his avatar at the bottom of the screen and has to shoot the enemy that moves randomly at the top.
Contents:
* Performance
* Game API
* Game loop
* GameCanvas
* Bitmaps
* Sprite
* Layer and TiledLayer
* LayerManager
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Unity Technologies
The developers of Varjo VR-1 learned a lot about human eye resolution and the demands it puts on virtual reality (VR) content. In these slides, you'll explore what next-generation VR can mean for your VR experiences. Learn about what matters the most when it comes to visual quality, the possible caveats, and the role performance requirements play in this equation.
Speaker:
Mikko Strandborg - Varjo
Abstract:
With an everyday increase in the number of cars on our roads and highways, we are facing numerous problems, for example:
• Smuggling of cars
• Invalid license plates
• Identification of stolen cars
• Usage of cars in terrorist attacks/illegal activities
In order to address the above issues, we took up the project of developing a prototype, which can perform license plate recognition (LPR). This project, as the name signifies, deals with reading, storing and comparing the license plate numbers retrieved from snapshots of cars to ensure safety in the country and ultimately help to reduce unauthorized vehicles access and crime.
License Plate Recognition (LPR) has been a practical technique in the past decades. It is one of the most important applications for Computer Vision, Patter Recognition and Image Processing in the field of Intelligent Transportation Systems (ITS).
Generally, the LPR system is divided into three steps, license plate locating, license plate character segmentation and license plate recognition. This project discusses a complete license plate recognition system with special emphasis on the Localization Module.In this study, the proposed algorithm is based on extraction of plate region using morphological operations and shape detection algorithms. Segmentation of plate made use of horizontal and vertical smearing and line detection algorithms. Lastly, template matching algorithms were used for character recognition.
The implementation of the project was done in the platforms of Matlab and OpenCV.
Building Native Apps- A Digital Canvas for Coders and Designers with Walter LuhFITC
Apps are the hottest new medium for interaction. But conventional technologies make creating graphically-rich, interactive content an enormous challenge. Learn how Corona SDK enables you to build apps 10x more quickly, whether you are a creative coder or a visual designer.
Interacting with the Qt Quick scene graph is a good bonus skill for any Qt developer to have. In this introductory webinar we will present this component: a graphical representation of the Item scene and an alternative method to QML coding. Proper use of the underlying scene graph can save performance at runtime. We will explore how to interact with the scene graph through a simple example and suggest when it is appropriate to use.
The game API is one of the most interesting and unique concepts of Java ME. It consists of very useful classes that help you with typical tasks that are required in almost ever game — for example sprite handling, tiled backgrounds or collision detection. This module will explain those concepts and how to create an own game loop. The challenge is the largest project yet and involves writing your own game called "Schlabo". The player moves his avatar at the bottom of the screen and has to shoot the enemy that moves randomly at the top.
Contents:
* Performance
* Game API
* Game loop
* GameCanvas
* Bitmaps
* Sprite
* Layer and TiledLayer
* LayerManager
Creating next-gen VR and MR experiences using Varjo VR-1 and XR-1 - Unite Cop...Unity Technologies
The developers of Varjo VR-1 learned a lot about human eye resolution and the demands it puts on virtual reality (VR) content. In these slides, you'll explore what next-generation VR can mean for your VR experiences. Learn about what matters the most when it comes to visual quality, the possible caveats, and the role performance requirements play in this equation.
Speaker:
Mikko Strandborg - Varjo
Abstract:
With an everyday increase in the number of cars on our roads and highways, we are facing numerous problems, for example:
• Smuggling of cars
• Invalid license plates
• Identification of stolen cars
• Usage of cars in terrorist attacks/illegal activities
In order to address the above issues, we took up the project of developing a prototype, which can perform license plate recognition (LPR). This project, as the name signifies, deals with reading, storing and comparing the license plate numbers retrieved from snapshots of cars to ensure safety in the country and ultimately help to reduce unauthorized vehicles access and crime.
License Plate Recognition (LPR) has been a practical technique in the past decades. It is one of the most important applications for Computer Vision, Patter Recognition and Image Processing in the field of Intelligent Transportation Systems (ITS).
Generally, the LPR system is divided into three steps, license plate locating, license plate character segmentation and license plate recognition. This project discusses a complete license plate recognition system with special emphasis on the Localization Module.In this study, the proposed algorithm is based on extraction of plate region using morphological operations and shape detection algorithms. Segmentation of plate made use of horizontal and vertical smearing and line detection algorithms. Lastly, template matching algorithms were used for character recognition.
The implementation of the project was done in the platforms of Matlab and OpenCV.
Building Native Apps- A Digital Canvas for Coders and Designers with Walter LuhFITC
Apps are the hottest new medium for interaction. But conventional technologies make creating graphically-rich, interactive content an enormous challenge. Learn how Corona SDK enables you to build apps 10x more quickly, whether you are a creative coder or a visual designer.
Cocos2d is a well known open source software framework on game industry. It is is a 2D game framework built upon the OpenGL ES API’s.
In this session, I will talk about a hierarchical structures of an Cocos2d node and scenes. Also Cocos2d Graphic User Interface, Physical System, Audio, Particle System and Scene Transition technique will be shown. Finally this session will show various branches of Cocos2d open source projects including Cocos2d-x, Cocos2d-Swift, Cocos2d-html5, and Cocos2d-xna.
Современный мир – это мир конкуренции. И любое преимущество перед другими может сыграть большую роль в бизнесе. Разработчиков в области 3D становится всё больше. Креативные дизайнеры изобретают всё более улётные проекты, и чтобы оставаться в тренде, нужно идти в ногу со временем. Я познакомлю вас с крутыми проектами и научу, как просто сделать 3D на сайте. Может и у вас появятся собственные идеи, как применить новейшие технологии уже сейчас!
Scene Graphs & Component Based Game EnginesBryan Duggan
A presentation I made at the Fermented Poly meetup in Dublin about Scene Graphs & Component Based Game Engines. Lots of examples from my own game engine BGE - where almost everything is a component. Get the code and the course notes here: https://github.com/skooter500/BGE
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
15. Elastic Image Software LLC
15
for each object in the scene
! determine its corresponding pixels
! for each corresponding pixel
! ! calculate depth of object at pixel
! ! if depth is closer than any object yet seen
! ! ! put this object in the pixel
! ! endif
! end
end
The GPU implements a z-buffer algorithm in hardware
16. Elastic Image Software LLC
In OpenGL, the Look is evaluated at the same time that
depth comparison is performed.
Together these are the core activities of computer graphics.
They are the raison d'être of the GPU. Compute intensive,
Highly optimized and parallelized.
16
17. Elastic Image Software LLC
17
Update Model State. This could entail geometric
transformation or perhaps taking a time step in
the physic engine.
27. Elastic Image Software LLC
27
Posing models. Positioning light sources.
Aiming the camera. All these task require
and understanding of transformation
matrices.
28. Elastic Image Software LLC
28
Transformation matrix. Coordinate frame
World space, Screen space, etc.
All are different ways of thinking about
the same underlying concept.
29. Elastic Image Software LLC
29
When we move an object we apply a
transformation via a transformation
matrix. This transformation is defined in
terms of a coordinate frame.
A specific location on the transformed
object can be interpreted in terms of any
coordinate frame we choose.
30. Elastic Image Software LLC
30
The motivation for a coordinate frame
transformation is not only motivated by the need
to pose a model or aim a camera as in the
physical world.
In computer graphics land it often has to do with
the convenience of performing a particular
calculation in one space rather then another.
31. Elastic Image Software LLC
31
We refer to the transformation pipeline: the successive
application of a series of transformations as a 3D model wends
its way from application land to GPU land.
32. Elastic Image Software LLC
Hierarchical modeling is based on the hierarchical
organization of transformations matrices. Many objects
- trees, robots, cars - form natural hierarchies.
32
33. Elastic Image Software LLC
33
The UIView class supports all the key concepts
of transformations and hierarchy. It is a nice,
friendly way to gain intuition about facility with
this powerful concept.
41. Elastic Image Software LLC
In what follows, we will be referring to the ES1
“fixed-function” transformation pipeline provided
by the GPU.
In ES2 (GLSL) the transformation pipeline must
be handled entirely in application space.
41
43. Elastic Image Software LLC
43
A camera with a spotlight attached to it orbits
around a stationary teapot model lit by three
stationary colored point light sources.
44. Elastic Image Software LLC
In iOS we never explicitly say “render scene”. Rather we
inform the system that now would be a good time to
redisplay the scene:
[myView setNeedsDisplay] and [myView drawRect]
44
47. Elastic Image Software LLC
! Position the camera
! glMatrixMode(GL_MODELVIEW);!
! glLoadIdentity();
! glLoadMatrixf(_openGLCameraInverseTransform);
47
http://github.com/turner/HelloTeapot/blob/master/Classes/GLViewController.m
48. Elastic Image Software LLC
Position spotlight at camera location
glPushMatrix();
! glMultMatrixf(_cameraTransform);!
!
! // A white spotlight for a camera headlight!
GLfloat spotLightColor[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat spotLightPosition[] = { 0.0, 0.0, 2.0, 1.0 };
GLfloat spotLightDirection[] = { 0.0, 0.0, -1.0, 1.0 };
GLfloat spotCutOff!! ! = 3.5;
!
! glEnable(GL_LIGHT3);
! glLightfv(GL_LIGHT3, GL_DIFFUSE, spotLightColor);!
! glLightfv(GL_LIGHT3, GL_POSITION, spotLightPosition);
! glLightfv(GL_LIGHT3, GL_SPOT_DIRECTION, spotLightDirection);
! glLightf(GL_LIGHT3, GL_SPOT_CUTOFF, spotCutOff);
!
! glPopMatrix();!
48
http://github.com/turner/HelloTeapot/blob/master/Classes/GLViewController.m
49. Elastic Image Software LLC
49
glPushMatrix & glPopMatrix
These functions push/pop a transformation matrix on/off the
transformation stack.
This stack is the key data structure for presenting a
hierarchical model to the GPU in fixed-function OpenGL.
50. Elastic Image Software LLC
50
glPushMatrix - Create a new matrix and push
it on the stack. Subsequent matrix concatenation
is done with stack.top.
stack.top is the current coordinate frame.
glPopMatrix - Pop the stack. The pre-existing
matrix is now stack.top.
We revert to the coordinate frame the existed
prior to the push.
! glPushMatrix();
! glMultMatrixf(_cameraTransform);
!
! glEnable(GL_LIGHT3);
! glLightfv(GL_LIGHT3, GL_DIFFUSE, spotLight);
! glPopMatrix();!
54. Elastic Image Software LLC
54
http://github.com/turner/HelloTeapot/blob/master/Classes/GLViewController.m
Position and draw the teapot
! glPushMatrix();
! JLMMatrix3DSetZRotationUsingDegrees(rotation, -45.0f);
! JLMMatrix3DSetScaling(scale, sx, sy, sz);
! JLMMatrix3DMultiply(rotation, scale, concatenation);
! glMultMatrixf(concatenation);
! for(int i = 0; i < num_teapot_indices; i += new_teapot_indicies[i] + 1) {
! ! glDrawElements(
GL_TRIANGLE_STRIP, indices[i],
GL_UNSIGNED_SHORT, &indices[i+1]
);
! } // for (num_teapot_indices)
! glPopMatrix();
55. Elastic Image Software LLC
55
http://github.com/turner/HelloTeapot/blob/master/Classes/GLViewController.m
Position and draw the teapot
! glPushMatrix();
! JLMMatrix3DSetZRotationUsingDegrees(rotation, -45.0f);
! JLMMatrix3DSetScaling(scale, sx, sy, sz);
! JLMMatrix3DMultiply(rotation, scale, concatenation);
! glMultMatrixf(concatenation);
! for(int i = 0; i < num_teapot_indices; i += new_teapot_indicies[i] + 1) {
! ! glDrawElements(
GL_TRIANGLE_STRIP, indices[i],
GL_UNSIGNED_SHORT, &indices[i+1]
);
! } // for (num_teapot_indices)
! glPopMatrix();
56. Elastic Image Software LLC
56
http://github.com/turner/HelloTeapot/blob/master/Classes/GLViewController.m
Position and draw the teapot
! glPushMatrix();
! JLMMatrix3DSetZRotationUsingDegrees(rotation, -45.0f);
! JLMMatrix3DSetScaling(scale, sx, sy, sz);
! JLMMatrix3DMultiply(rotation, scale, concatenation);
! glMultMatrixf(concatenation);
! for(int i = 0; i < num_teapot_indices; i += new_teapot_indicies[i] + 1) {
! ! glDrawElements(
GL_TRIANGLE_STRIP, indices[i],
GL_UNSIGNED_SHORT, &indices[i+1]
);
! } // for (num_teapot_indices)
! glPopMatrix();
57. Elastic Image Software LLC
57
Notice the absence of GL_CAMERA?
You may be surprised to learn there is no concept of
camera in OpenGL. Camera posing is equivalent to
inverting the camera transform and applying it to the
scene observed by the camera.
63. Elastic Image Software LLC
The vertices comprising the 3D geometry of the teapot
float teapot_vertices [] = {
0.0663, 0.1178, 0.0,
0.0672, 0.1152, 0.0,
0.0639, 0.1178, 0.0178043,
...
};
The surface normals associated with each vertex
// The list of surface normals corresponding to the vertices
float teapot_normals[] = {
-0.987635, -0.156768, 0,
-0.902861, -0.429933, 0,
-0.953562, -0.156989, -0.257047,
...
};
63
64. Elastic Image Software LLC
The teapot model is defined as a collection of triangle stripes
that combine to form the teapot surface.
short indicies[] = {
// how many vertices in vertex strip
26,
// vertex strip indices
1122, 1243, 1272, 1242, ... ,1283, 1199,
...
};
64
67. Elastic Image Software LLC
67
We now begin leaving behind the fixed-
function pipeline of ES1 and focus on
ES2, GLSL, and visual coolness in
general.
68. Elastic Image Software LLC
The Look: the lighting, illumination model,
and surface shaders that in combination
achieve the desired look of a model in a
scene.
68
76. Elastic Image Software LLC
Surface shaders were introduced to the field of computer graphics
by Pixar with its rendering API and shading language called
RenderMan.
A shader is a small functions evaluated at every location on a
being rendered.
GLSL borrows heavily from the RenderMan model.
76
82. Elastic Image Software LLC
82
Before we dive into shaders lets get a lay of the land. There are two
flavors of shaders in GLSL.
A vertex shader is evaluated at each vertex.
A fragment shader is evaluated at each screen space pixel
corresponding to a sampled on the facet being rasterized.
83. Elastic Image Software LLC
83
Vertex and fragment shaders work together in a pipeline fashion. Vertex
attributes - color, surface normal, texture coordinate - are evaluated in
the vertex shader then passed on to the fragment shader where those
values are interpolated across the surface.
84. Elastic Image Software LLC
84
ShowST. A shader that visualizes the texture
coordinate parameterization of a surface.
89. Elastic Image Software LLC
89
http://github.com/turner/HelloiPadGLSL/blob/master/Shaders/ShowST.fsh
// ShowST.fsh
varying vec2 v_st;
void main() {
// Visualize the s-t parameterization of the underlying surface
gl_FragColor.r = v_st.s;
gl_FragColor.g = v_st.t;
gl_FragColor.b = 0.0;
gl_FragColor.a = 1.0;
}
The texture coordinate values v_st.s and v_st.t
are for the red and green channels of the shader color.
90. Elastic Image Software LLC
90
TexturePairShader. A shader that mixes the
colors of a pair of textures using the tweaked
alpha channel of one of the pair.
Fail Whale over Mandril
94. Elastic Image Software LLC
94
attribute vec2 myVertexST - Vertex attribute
varying vec2 v_st - Varies across the surface
uniform sampler2D myTexture_0 - Invariant throughout rendering cycle
Shader variables come in different flavors
95. Elastic Image Software LLC
95
An application communicates with its shaders in the follow ways:
• attributes - geometry, color, normal, texture coordinate
• uniforms - texture sampler, matrix, eye vector, light vector
• textures - texture channels - r, g, b, a - are not just for color
attribute vec2 myVertexST - Vertex attribute
varying vec2 v_st - Varies across the surface
uniform sampler2D myTexture_0 - Invariant throughout rendering cycle
96. Elastic Image Software LLC
96
Lets look at how we wire our iOS app together
with our shaders. We will use a texture shading
example.
https://github.com/turner/HelloShader/blob/master/HelloShader/Classes/Renderer/GLRenderer.m
97. Elastic Image Software LLC
97
First make a texture object ...
TEITexture *t =
[[ [TEITexture alloc] initWithImageFile:@"twitter_fail_whale_red_channnel_knockout"
extension:@"png"
mipmap:YES ] autorelease];
[glView.renderer.rendererHelper.renderables setObject:t forKey:@"texture_0"];
99. Elastic Image Software LLC
99
Associate shader uniform with application object instance ...
TEITexture *t =
(TEITexture *)[self.rendererHelper.renderables objectForKey:@"texture_0"];
t.location = glGetUniformLocation(m_program, "myTexture_0");
glActiveTexture( GL_TEXTURE0 );
glBindTexture(GL_TEXTURE_2D, t.name);
glUniform1i(t.location, 0);
Activate a texture unit, bind it to a texture object, and assign a number to the
corresponding texture sampler used in the fragment shader
100. Elastic Image Software LLC
100
We now have a linkage between our application texture object and a texture
sampler in our fragment shader. Rock.
104. Elastic Image Software LLC
104
Texture mapping is the fundamental tool for creating visual complexity
105. Elastic Image Software LLC
105
By establishing a mapping between a surface and a texture we can “attach”
the texture to the surface.
The interpretation of the a can go far beyond that of a decal to be applied to
a surface. Bumps, opacity, displacement, and much more can be designed
with a texture.
107. Elastic Image Software LLC
107
Shaders can have it both ways: Compute surface
color (or surface roughness, or opacity) algorithmically
or look it up in a texture. Or a bit of both.
109. Elastic Image Software LLC
• OpenGL is mostly M
• Keep V dumb
• Lots of chatter between M and C
MVC
109
110. Elastic Image Software LLC
110
Lets take a look at how iOS and OpenGL interact. We will us
Hello iPad OpenGL as our guide.
https://github.com/turner/HelloShader
112. Elastic Image Software LLC
112
Rendering frame rate is sync-ed to the screen refresh rate.
The actual rendering is handled via a selector.
- (void)startAnimation {
if (!self.isAnimating) {
self.displayLink =
[NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self
selector:@selector(drawView:)];
[self.displayLink setFrameInterval:animationFrameInterval];
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSDefaultRunLoopMode];
self.animating = YES;
} // if (!self.isAnimating)
}
113. Elastic Image Software LLC
113
// framebuffer
glGenFramebuffers(1, &m_framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
// rgb buffer
glGenRenderbuffers(1, &m_colorbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, m_colorbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorbuffer);
[m_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &m_backingWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &m_backingHeight);
// z-buffer
glGenRenderbuffers(1, &m_depthbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, m_depthbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, m_backingWidth, m_backingHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthbuffer);
A framebuffer object is created. A color and depth buffer
are attached.
114. Elastic Image Software LLC
114
- (void) render {
! !
[EAGLContext setCurrentContext:m_context];
glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
// transform, light, shade, etc.
glBindRenderbuffer(GL_RENDERBUFFER, m_colorbuffer);
[m_context presentRenderbuffer:GL_RENDERBUFFER];
}
The render loop. Draw to the colorbuffer then present to
the display. This is the classic “ping pong” between back
buffer and front buffer.