In this lesson we cover setting up WebGL for use, including creating a canvas, getting the WebGL rendering context and clearing the canvas to a particular color.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Setup</title> </head>
<body>
<canvas id="canvas" width="600" height="600"></canvas>
<script src="./mian.js"></script>
</body>
</html>
var gl;

initGL();
draw(); function initGL(){
var canvas = document.getElementById("canvas");
gl = canvas.getContext("webgl"); gl.viewport(0,0,canvas.width, canvas.height);
gl.clearColor(1,0,0,1); //red, blue, green, alpha
} function draw(){
gl.clear(gl.COLOR_BUFFER_BIT); //Paint the color to the canvas
}

最新文章

  1. 封装一个函数获取匹配特定的css选择符
  2. C#客户端的异步操作
  3. 使用PHPMailer发送邮件
  4. RMQ 数据结构
  5. iOS应用架构谈(三):网络层设计方案(上)
  6. 更改form字段内容颜色
  7. Java对象的复制
  8. Cannot find class [org.apache.commons.dbcp.BasicDataSource]
  9. android 开发工具(android studio)
  10. python 路径
  11. 使用Velocity 模板引擎快速生成代码
  12. Linux第六节随笔 输入输出重定向 、管道、通配符、wc / grep / tr / sort / cut / which /whereis /locate /find /
  13. [Swift]LeetCode10. 正则表达式匹配 | Regular Expression Matching
  14. blfs(systemd版本)学习笔记-安装、配置和使用wpa_supplicant无线网络连接工具
  15. 自动化测试基础篇--Selenium文件上传send_keys
  16. IIS安装、配置 发布网站 报错解决方案
  17. Python3编写网络爬虫08-数据存储方式一-文件存储
  18. IDEA配置SVN,Git,GitLab
  19. siege 高并发测试工具
  20. Enterprise Library 5.0 参考源码索引

热门文章

  1. mysql open files
  2. C# 中LinkLabel的简单使用
  3. ant 安装过程中问题记录
  4. ARM处理机模式--内部寄存器
  5. UNIX系统文件
  6. codeforces 704B - Ant Man 贪心
  7. 内核源码分析之软中断(基于3.16-rc4)
  8. Multiple reportviewers on one page With reportviwer 11.0
  9. java的动态代理机制
  10. SRM 509 DIV1 500pt(DP)