当前位置:网站首页>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 :
边栏推荐
- [quick start of Digital IC Verification] 19. Basic grammar of SystemVerilog learning 6 (thread internal communication... Including practical exercises)
- Connecting FTP server tutorial
- [quick start of Digital IC Verification] 25. AHB sramc of SystemVerilog project practice (5) (AHB key review, key points refining)
- How to create Apple Developer personal account P8 certificate
- 连接ftp服务器教程
- Nacos conformance protocol cp/ap/jraft/distro protocol
- Unity之ASE实现全屏风沙效果
- 【OBS】RTMPSockBuf_ Fill, remote host closed connection.
- Database exception resolution caused by large table delete data deletion
- [quick start of Digital IC Verification] 29. Ahb-sramc (9) (ahb-sramc svtb overview) of SystemVerilog project practice
猜你喜欢
"Baidu Cup" CTF competition 2017 February, web:include
使用Scrapy框架爬取网页并保存到Mysql的实现
The difference between full-time graduate students and part-time graduate students!
CTFshow,信息搜集:web2
HW primary flow monitoring, what should we do
MySQL bit type resolution
Introduction of mongod management database method
Configure mongodb database in window environment
With 8 modules and 40 thinking models, you can break the shackles of thinking and meet the thinking needs of different stages and scenes of your work. Collect it quickly and learn it slowly
[quickstart to Digital IC Validation] 20. Basic syntax for system verilog Learning 7 (Coverage Driven... Including practical exercises)
随机推荐
Bits and Information & integer notes
避坑:Sql中 in 和not in中有null值的情况说明
Guangzhou Development Zone enables geographical indication products to help rural revitalization
【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
Create lib Library in keil and use lib Library
STM32F103C8T6 PWM驱动舵机(SG90)
[quick start of Digital IC Verification] 19. Basic grammar of SystemVerilog learning 6 (thread internal communication... Including practical exercises)
数学建模——什么是数学建模
Why do we use UTF-8 encoding?
Unity's ASE achieves full screen sand blowing effect
Integer learning
使用cpolar建立一个商业网站(2)
【數據挖掘】視覺模式挖掘:Hog特征+餘弦相似度/k-means聚類
Keil5 does not support online simulation of STM32 F0 series
Monthly observation of internet medical field in May 2022
2.Golang基础知识
jacoco代码覆盖率
知否|两大风控最重要指标与客群好坏的关系分析
There is a cow, which gives birth to a heifer at the beginning of each year. Each heifer has a heifer at the beginning of each year since the fourth year. Please program how many cows are there in the
银行需要搭建智能客服模块的中台能力,驱动全场景智能客服务升级