当前位置:网站首页>Webgl programming guide learning (0)
Webgl programming guide learning (0)
2022-06-11 14:14:00 【Jiemingcheng】
WebGL Programming guide learning , Jieming city ,2022-3-1
0. WebGL Programming , From entering the pit to giving up
- Knowledge path
- 《WebGL Programming Guide 》 Environment building
- WebGL Programming paradigm
0.1 Knowledge path
- Level 1: Understand computer graphics , In particular, rendering related concepts
- Level 2: Used to OpenGL, know
0.2 《WebGL Programming Guide 》 Environment building
0.2.1 TODO
Comments on this book , It will be updated after reading the whole book
0.2.2 Code running environment
- Local operating environment :MacOS Monterey 12.2.1
- Editor :VS Code
- This book is right. WebGL Feature support :WebGL 1.0 API
- The library files provided in this book :
- webgl-utils.js: The main function is to obtain WebGL The context of the running browser
- webgl-debug.js: Mainly provide for WebGL Code , Especially the debugging function of shader code
- cuon-utils.js: Author defined access WebGL Functions of context , There are also some common shader functions
- cuon-matrix.js: Some matrix operation functions defined by the author , Other math related things
- Library file download address : link : https://pan.baidu.com/s/1PBWKxVcl_Kv7iUVf8RtfoQ password : cocs
- Supported browsers : Suggest Chrome
0.3 WebGL Programming paradigm
0.3.1 WebGL Software architecture

0.3.2 WebGL Application paradigm
HTML5 Introduced tags send JavaScript It is possible to draw graphics dynamically
Programming paradigm
- HTML file :
- Build a , Make it possible to draw graphics
- call JavaScript file , stay JavaScript Use... In the document WebGL Rendering
- JavaScript Program :
- Get elements
- obtain WebGL Drawing context ( That is to say WebGL The area drawn is )
- OpenGL Render pipeline
0.3.3 WebGL Rendering pipeline of web pages
TODO
0.3.4 WebGL Render pipeline

- perform JavaScript Program , call WebGL Related methods
- perform WebGL Related methods
- Operate vertex by vertex —— Vertex shader
- Slice by slice operation —— Chip shader
- Render to color buffer
- Show
0.3.5 WebGL Program structure
- Get elements
- obtain WebGL Drawing context
- Initialize shaders
- Set color buffer ( That is to say ) Background color
- draw
JavaScript Program
// from HTML obtain canvas Elements
var canvas = document.getElementById('webgl');
// obtain WebGL Context
var gl = getWebGLContext(canvas);
if (!gl){
console.log(' Can't get WebGL Context ');
return;
}
// Initialize shaders
if(!initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE)){
console.log(' Failed to initialize shader ');
return;
}
// Set color buffer background
gl.clearColor(0.0, 0.0, 0.0, 1.0)
// Clear color buffer
gl.clear(gl.COLOR_BUFFER_BIT)
// draw
gl.drawArrays(gl.POINTS, 0, 1)
Shaders Shader( The string form is written in JavaScript in )
var VSHADER_SOURCE = ''
var FSHADER_SOURCE = ''
边栏推荐
- [public class preview]: mxplayer Ott audio and video transcoding practice and optimization
- How to manage the server to make the website stable and smooth
- 2022.2.26 library management system 2 - module 2: reader management system
- 可变参表达式
- 2021-2027 China scaffold and accessories market status analysis and development prospect forecast report
- Question bank and answers for 2022 tool fitter (intermediate) operation certificate examination
- Work summary: it took a long time to write SQL because of Cartesian product problem (Cartesian product summary attached)
- AGV robot RFID sensor ck-g06a and Siemens 1200plc Application Manual
- C. Mortal Kombat Tower(cf)dp
- Single table query of SQL data query
猜你喜欢

No delay / no delay live video instance effect cases

Learning notes of yolov3: model structure of yolov3

Introduction to reverse learning - excellent assembly debugging tool OllyDbg

Vi LXD deployment of lab server for development records

cadence SPB17.4 - allegro - allegro_ free_ viewer

Unsealing easy QF PDA helps enterprises improve ERP management

Lake Shore HR series sensors

Energy storage operation and configuration analysis of high proportion wind power system (realized by Matlab)

YOLOv3学习笔记:YOLOv3的模型结构

基于Qt开发实现的任务管理器
随机推荐
Airtest automated test
[public class preview]: mxplayer Ott audio and video transcoding practice and optimization
.NET C#基础(6):命名空间 - 有名字的作用域
Precision alignment adjustment platform
Powerful full text search tool anytxt searcher
How to quickly compress the size of video?
Chip engineers are too expensive? Your sister
vim二次替换
2022-2028 global and Chinese near field scanning optical microscope (NSOM) market status and future development trend
Ponds(拓扑 + 优先队列)
Just after the college entrance examination, I was confused and didn't know what to do? Tell me what I think
No delay / no delay live video instance effect cases
[Clickhouse] the clckhouse view can be inserted but not queried
【Try to Hack】URL
Introduction to reverse learning - excellent assembly debugging tool OllyDbg
六.开发记录之实验室服务器LXD部署
CVPR 2022 | 神经辐射场几何编辑方法NeRF-Editing
AGV robot RFID sensor ck-g06a and Siemens 1200plc Application Manual
[Clickhouse column] user initialization of new library role
Three level classification display