当前位置:网站首页>Getting started with webgl (1)
Getting started with webgl (1)
2022-07-07 15:38:00 【Vegetable chicken on the road】
1. What is? webGL?
webgl Is to draw and render graphics on Web pages (3D graphics ), And allow users to interact with it ;
2. Why do I learn webGL?
Optimize performance in game development , It's in web You can develop and directly view the effect , Easy to translate into game development to understand .
3. The simplest webGL Program ( Clear plot area )
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>03 Draw and transform </title>
</head>
<body onload="main()">
<canvas id = "webgl",width = "400" , height="400"></canvas>
<script src="libs/webgl-utils.js"></script>
<script src="libs/webgl-debug.js"></script>
<script src="libs/cuon-utils.js"></script>
<script src = "RotateTriangle.js"></script>
</body>
</html>
<RotateTriangle.js>
function main() {
// obtain <canvas> Elements
var canvas = document.getElementById('webgl');
// obtain WebGL Rendering context
var gl = getWebGLContext(canvas);
if (!gl) {
console.log('Failed to get the rendering context for WebGL');
return;
}
// Specify empty <canvas> The color of the
gl.clearColor(0.0, 0.0, 0.0, 1.0);
// Empty <canvas>
gl.clear(gl.COLOR_BUFFER_BIT);
}
Library address referenced above :https://gitee.com/JingEra/web-gl-common-library, Please download by yourself .
Of course, if you don't want to use the encapsulated library, you can write it yourself , Let me also put a reference project below . Address :https://gitee.com/JingEra/web-gl-common-library/tree/master/03
I am because some method calls of the encapsulated library are more convenient in the process of reading and learning .
4. understand
There seems to be nothing to explain , Mainly :
边栏推荐
- #HPDC智能基座人才发展峰会随笔
- [original] all management without assessment is nonsense!
- leetcode 241. Different ways to add parentheses design priority for operational expressions (medium)
- 什么是pv和uv? pv、uv
- 【深度学习】图像超分实验:SRCNN/FSRCNN
- MySQL bit类型解析
- Guangzhou Development Zone enables geographical indication products to help rural revitalization
- MySQL bit type resolution
- Yunxiaoduo software internal test distribution test platform description document
- Unity之ASE实现卡通火焰
猜你喜欢

CTFshow,信息搜集:web2
Window环境下配置Mongodb数据库
![[understanding of opportunity -40]: direction, rules, choice, effort, fairness, cognition, ability, action, read the five layers of perception of 3GPP 6G white paper](/img/38/cc5bb5eaa3dcee5ae2d51a904cf26a.png)
[understanding of opportunity -40]: direction, rules, choice, effort, fairness, cognition, ability, action, read the five layers of perception of 3GPP 6G white paper

Typescript release 4.8 beta

【深度学习】图像超分实验:SRCNN/FSRCNN

The difference between full-time graduate students and part-time graduate students!

【数字IC验证快速入门】18、SystemVerilog学习之基本语法5(并发线程...内含实践练习)

Ctfshow, information collection: web4

Ctfshow, information collection: web14

数学建模——什么是数学建模
随机推荐
2. 堆排序『较难理解的排序』
"Baidu Cup" CTF competition 2017 February, web:include
What are PV and UV? pv、uv
Whether runnable can be interrupted
15. Using the text editing tool VIM
Write a ten thousand word long article "CAS spin lock" to send Jay's new album to the top of the hot list
Window环境下配置Mongodb数据库
如何在opensea批量发布NFT(Rinkeby测试网)
【搞船日记】【Shapr3D的STL格式转Gcode】
[original] all management without assessment is nonsense!
MongoDB数据库基础知识整理
【Markdown语法高级】让你的博客更精彩(四:设置字体样式以及颜色对照表)
一个需求温习到的所有知识,h5的表单被键盘遮挡,事件代理,事件委托
Ctfshow, information collection: web9
How to build your own super signature system (yunxiaoduo)?
使用Scrapy框架爬取网页并保存到Mysql的实现
【数字IC验证快速入门】22、SystemVerilog项目实践之AHB-SRAMC(2)(AMBA总线介绍)
Ctfshow, information collection: web6
“百度杯”CTF比赛 2017 二月场,Web:include
Actually changed from 408 to self proposition! 211 North China Electric Power University (Beijing)