# Optoelectronics and Photonics

• Maxwell’s equation
• Geometrical optics
• Interference
• Diffraction
• Fresnel’s equation
• Group velocity
• Group index
• Quantum mechanical concepts
• Vectors
• Complex numbers
• Partial differentiation
• Fourier transforms
• Wave theory
• Particle theory
• light
• Wave theory: wave => interference, diffraction
• Particle theory: photon

# Wave Nature of Light

## Light Waves in a Homogeneous Medium

### Plane Electromagnetic Wave

• Electric field Ex
• Magnetic field By
• Electromagnetic wave
• traveling wave
• time varying
• perpendicular to each other and the direction of propagation: z
• position z
• time t
• propagation constant, wave number k (2*pi/lambda)
• wavelength lambda
• angular frequency omega
• wave amplitude E0
• Phase constant phi0
• Argument (omega*t – k*z + phi0) => phase phi
• Monochromatic plane wave
• wavefront
• Faraday’s law: time varying magnetic field results in time varying electric fields and vice versa
• optical field
z = a+b\,\mathrm i \\ |z| = \sqrt{a^2 + b^2} \\ z = r \cdot \mathrm{e}^{\mathrm{i}\varphi} = r \cdot (\cos \varphi + \mathrm{i} \cdot \sin \varphi) \\ \phi = \omega t - k z + \phi_0 \\ a^{x+y}=a^x \cdot a^y \\ a^{x\cdot y}=(a^{x})^{y} \\ {\displaystyle a^{-x}={\frac {1}{a^{x}}}=\left({\frac {1}{a}}\right)^{x}} \\ {\displaystyle {\sqrt[{q}]{a^{p}}}=a^{\frac {p}{q}}}

# Vulkan: Raytrace / Raytracing

### Peter Shirley

• eye / camera
• image
• 16:9 aspect ratio
• viewport =
• viewport’s aspect ratio == rendered image aspect ratio
• viewport: 2 units in height
• projection plane
• projection point
• distance between plane and point: 1 unit = focal length

#### C++

difference between global operator and member operator

#### Depends on

github.com/nothings/stb, stb single-file public domain libraries for C/C++
Markdeep

# OpenGL Frameworks

An OpenGL Loading Library is a library that loads pointers to OpenGL functions at runtime, core as well as extensions. This is required to access functions from OpenGL versions above 1.1 on most platforms.

• GLEW (OpenGL Extension Wrangler)
• GL3W
• Galogen
• Glatter
• glsdk (Unofficial OpenGL SDK)
• glbinding (C++)
• libepoxy
• GLee

GLFW, GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop
GLUT (GL Utility Toolkit)
What is the difference between FreeGLUT vs GLFW?

### Scratchapixel 2.0

• The Rasterization Algorithm
• Optimizing: 2D Triangles Bounding Box
• When Two Triangles Overlap the Same Pixel: The Depth Buffer (or Z-Buffer)

### Canvas + WebGL

How to render 3D in 2D canvas

### VICTOR KESTEN

Evaluating Different Spatial Anti Aliasing Techniques

### RayTracingInVulkan

github.com/GPSnoopy/RayTracingInVulkan, Implementation of Peter Shirley’s Ray Tracing In One Weekend book using Vulkan and NVIDIA’s RTX extension.

### nvpro-samples

nvpro-samples.github.io/vk_mini_path_tracer/
nvpro-samples.github.io/vk_raytracing_tutorial_KHR/
github.com/nvpro-samples/vk_denoise, Denoising a Vulkan ray traced image using OptiX denoiser
github.com/nvpro-samples/vk_raytrace, Ray tracing glTF scene with Vulkan
github.com/nvpro-samples/vk_raytracing_tutorial_NV, Vulkan ray tracing examples and tutorials using VK_NV_ray_tracing

Vulkan Tutorial

### PBRVulkan

github.com/Zielon/PBRVulkan/

### FlyCube

github.com/andrejnau/FlyCube, Graphics API wrapper is written in C++ on top of Directx 12 and Vulkan. Provides main features including ray tracing.

### Research Unit of Computer Graphics | TU Wien

github.com/cg-tuwien/Gears-Vk, Powerful low-level C++20 rendering framework for Vulkan 1.2, including Real-Time Ray Tracing (RTX) support, built atop Auto-Vk.
github.com/cg-tuwien/Auto-Vk, Low-level convenience and productivity layer atop Vulkan-Hpp

# Window System Integration (WSI)

### Brendan Galea

Vulkan (c++) Game Engine Tutorials

### Window System Integration (WSI)

XDC 2019 | Introducing the Vulkan WSI Layer – Rosen Zhelev

### RuhrJS Conference

RuhrJS 2018 – Martin Splitt – Creative experiments with WebGL shaders in JavaScript

### thebennybox

Intro To Modern OpenGL Tutorial (Playlist)

### Reducible

Building Collision Simulations: An Introduction to Computer Graphics

### The Cherno

OpenGL (Playlist), last update 2020
Welcome to OpenGL
Vertex Buffers and Drawing a Triangle in OpenGL
ImGui in OpenGL

### freeCodeCamp.org

OpenGL Course – Create 3D and 2D Graphics With C++

### NamePointer

I created my own Ray Tracing Engine from scratch

### Arun Ravindran ArunRocks

Building a Ray Tracer in Python – Part 1 (Points in 3D Space)

### media.ccc.de

Introduction to OpenGLES and GLSL programming
NOT in this talk:

• Clipping
• Vendor Extensions
• Lightning
• Stencils
• Framebuffer Objects
• Culling
• Framerate
• Quaternions
• Blending

OpenGL

• API for rendering 2D and 3D Computer Graphics
• Developed by SGI in 1992
• Open Standard, now maintained by Khronos Group consortium
• Used in CAD, Games, VR/AR, etc…

OpenGL ES

• OpenGL for Embedded Systems
• Implementations by nvidia, AMD, etc.
• Available on Windows, MacOSX, Linux, iOS, Android, etc.
• Bindings for C, C++, Java, C#, Python, Ruby, Go, etc.
• … but anything from OpenGL ES 2.0 onwards is cool!

EGL

• Native Platform Interface
• Creates & Configures OpenGL ES Context (view/window/fullscreen)
• Your platform might come with something else (Mesa, WGL, CGL, GLX, etc.)

Rasterizer

• Describe our geomentry in world coordinates (3D)
• Rasterizer projects it onto a projection plane (2D) => your screen
• Geometry in projection plane are now called fragments
• For each of the triangles, we figure out how we wan to color them
• If we have a triangle on that surface with 3 colors, the rasterizer will interpolate the values between the colors (pixel by pixel)
• Vertex- and Fragment-Shader go the projection and the texture mapping
• When you render a scene, the vertex shader is responsible for taking all your geometry and transforms/moves/scales it. Then it’s passed to the Rasterizer stage that does the real projection, figuring out which vertices end up on the 2D surface (plane) => output: fragments.

• C-like syntax
• Vector and Matrix types (float, vec2, vec3, vec4, mat4, etc.)
• Built-in math functions (sin, cos, exp, sqrt, dot, cross, etc.)
• No recursion
• Limited loops

• Runs once for each vertex of each triangle of the geometry
• Get per-vertex input from attribute
• Global parameters: get parameters from uniform: projection from camera
• Pass output to fragment shader in varying
• Pass position vector to rasierizer pipeline in gl_Position (magic variable)

• Runs once for each fragment of each rasterized triangle
• Sets the final color for each fragment
• Get per-vertex input from varying
• Get parameters from uniform: get texture data from uniform sample2D
• Pass color vector to fragment pipeline in gl_FragColor

Math

• Vectors describe coordinates
• Matrices describe transformations

Vector Operations

• Scalar Multiplication / dot-product: alpha = acos(dot(u,v))
• Vector Multiplication / cross-product: n = cross(u,v)

Transformation Matrices

• Translate
• Rotate
• Scale

Projection Matrix (perspective vs. orthographic)

Matrix Operations

• Multiplication of a vector with a matrix: transformed vector
• Multiplication of a matric with a matrix: chained transformation

### GetIntoGameDev

github.com/amengede/getIntoGameDev

OpenGL with C++ (Playlist)
Vulkan with C++ (Playlist)
OpenGL with Python (Playlist)
OpenGL with Python – Vertex Buffer Objects and Vertex Array Objects

### OGLdev – Modern OpenGL Tutorials

OGLdev – Modern OpenGL Tutorials

• World Coordinate System
• Local Coordinate System
• Object Coordinate System
• Object Space
• View Transformation
• Camera Transformation
• Eye Transformation
• Camera Coordinate System
• View Coordinate System
• Camera Space
• View Space
• Eye Space
• Perspective Projection
• Perspective Projection Matrix
• = Clip Coordinate System
• = Clip Space
• Perspective Division
• Range -1 ro +1 on all axes
• = Normalized Device Coordinates (NDC)
• Viewport Transformation
• = Window coordinates (ex. 1920 x 1080)
• Multiply all matrices to a single matrix
• = WVP / MVP
• UVN camera
• Location / Position (x, y, z)
• Orientation in UVN axis system
• N vector = eye to world
• V vector = up-vector/li>
• U vector = right-vector/li>

### David Parker (2011 – 2013)

OpenGL Screencasts and Tutorials

### GamesWithGabe

How to Code Minecraft (GLFW & Glad)

### Victor Gordan

OpenGL Tutorials, 13.08.2021 (Playlist)

### Michael Grieco

C++ OpenGL Tutorial (Playlist)
2D Pong (C++ OpenGL) (Playlist)

### Thomas Sheppard (Galway-Mayo Institute of Technology, Ireland)

Introduction to perspective projection

### Build Succeeded (Direct2D)

C++ Win32 Direct2D

#### Ressource

github.com/BuildSucceeded/3D-Game-Engine

### Pikuma

Math for Game Developers: Perspective Projection Matrix

### Danakorn

Projection in Computer Graphics

### Pythonista_

How to make a 3D projection in Python | Rendering a cube in 2D! (No OpenGL)

#### Ressource

github.com/Magoninho/3D-projection-tutorial

# Medium

Parallelizing GPU-intensive Workloads via Multi-Queue Operations using Kompute & Vulkan

# Udacity

GPU computing in Vulkan, The ultimate way to parallel computing using Vulkan API.
Learn the Vulkan API with C++, Learn the fundamentals of the popular Vulkan API for modern graphics rendering using C++!

# Learn OpenGL

Normal Mapping

TBN matrix

• Tangent,
• Bitangent and
• Normal vector

# GLEW

1>OpenGLBook_Chapter1.obj : error LNK2001: unresolved external symbol __imp__glewGetErrorString@4
1>OpenGLBook_Chapter1.obj : error LNK2001: unresolved external symbol __imp__glewInit@0
1>C:\Users\bacr\source\repos\FreeGLUT_example2\Release\FreeGLUT_example2.exe : fatal error LNK1120: 2 unresolved externals

#define GLEW_STATIC
1>OpenGLBook_Chapter1.obj : error LNK2001: unresolved external symbol _glewGetErrorString@4
1>OpenGLBook_Chapter1.obj : error LNK2001: unresolved external symbol _glewInit@0
1>C:\Users\bacr\source\repos\FreeGLUT_example2\Release\FreeGLUT_example2.exe : fatal error LNK1120: 2 unresolved externals

>dumpbin -headers glew-2.1.0\lib\Release\Win32\glew32.lib | findstr /c:"  Symbol name  : _glewInit"
Symbol name  : _glewInit@0

Build started...
1>------ Build started: Project: FreeGLUT_example2, Configuration: Release Win32 ------
1>main.cpp
1>OpenGLBook_Chapter1.cpp
1>tutorial01.cpp
1>Generating code
1>All 16 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
1>Finished generating code
1>FreeGLUT_example2.vcxproj -> C:\Users\bacr\source\repos\FreeGLUT_example2\Release\FreeGLUT_example2.exe
1>        1 Datei(en) kopiert.
1>        1 Datei(en) kopiert.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


# io7m

### r2

com.io7m.r2 0.3.0-SNAPSHOT Documentation
github.com/io7m/r2, Aggressively minimalist deferred renderer

# Wikipedia

Kategorie:Bildsynthese
Framebuffer Object (FBO)
Vertex Buffer Object (VBO)
Immediate Mode
Retained Mode
Z-Buffering (auch Depth Buffering, Tiefenpuffer)
Rasterung von Polygonen

# Microsoft Docs

Retained Mode Versus Immediate Mode

# OpenGL Documentation

### docs.GL

docs.GL (only OpenGL, no utility functions!)

EliteBook 850 G8

# DCM900 Digital Camera for Microscope

### Python DirectShow

List Capture Devices for Python OpenCV on Windows

#### ULARGE_INTEGER

What ctypes types to use with WORD and DWORD definitions

### Python OpenCV

import numpy as np
import cv2

def show_pic():

i: int = 0

while True:
cap = cv2.VideoCapture(i)

if not cap.isOpened():
print(f"Cannot open camera {i}")

else:
while True:

if not ret:
print(f"Can't receive frame (stream end?) from camera {i}. Exiting ...")
break
else:
break

cap.release()
i += 1

if i > 20:
break

if __name__ == '__main__':
show_pic()


Cannot open camera 0
Cannot open camera 1
Cannot open camera 2
Cannot open camera 3
Cannot open camera 4
Cannot open camera 5
Cannot open camera 6
Cannot open camera 7
Cannot open camera 8
Cannot open camera 10
Cannot open camera 11
Cannot open camera 12
Cannot open camera 13
Cannot open camera 15
Cannot open camera 16
Cannot open camera 17
Cannot open camera 18
Cannot open camera 19
Cannot open camera 20

[
0: 'ScopeTek DCM130BW',
1: 'ScopeTek DCM130E',
2: 'ScopeTek DCM200',
3: 'ScopeTek DCM310',
4: 'ScopeTek DCM35E',
5: 'ScopeTek DCM500',
6: 'ScopeTek DCM500BW',
7: 'ScopeTek DCM510',
8: 'ScopeTek DCM800',
9: 'ScopeTek DCM900',
10: 'ScopeTek MDC140BW',
11: 'ScopeTek MDC200',
12: 'ScopeTek MDC320',
13: 'ScopeTek MDC560',
14: 'OBS Virtual Camera'
]


### Linux

idVendor=0547 idProduct=4d90

0547  Anchor Chips, Inc.
4d90  AmScope MD1900 camera


usb.ids
microscope:start
AmScope/TopuTek/ScopeTek does provide libusb drivers though, so you could make a custom application.

### keyboard

conda install -c conda-forge keyboard


### pygame

Camera Module Introduction

Installation of pygame with Anaconda

Conda Support for 1.9.6 and 2.0.0.dev10 #1953

python -m pip install -U pygame --user
python -m pip uninstall pygame


# FreeBSD 12.2 Mail Server

### dotecot

# make clean && make rmconfig
===>  Cleaning for dovecot-2.3.15
===> No user-specified options configured for dovecot-2.3.15