WebGL

​前端通往架构师之路

我与影子孤独终老i 提交于 2021-02-17 18:27:21
作者:吕小鸣 链接:http://www.imooc.com/article/291995 前端架构师, 听起来就是个很高大上的职位,在大多数程序员的眼中,架构师一般从事后端开发,Java或者C++出身,它们往往拥有这十八般武艺,可以解决业务中出现的各种问题。好像架构师就从来没有和前端有过关系,那么真的是这样么,通读此文,便可豁然开朗。 前端的意义 首先,我们先来谈谈本职工作,前端的意义。前端源自用户界面,是最先和用户接触的地方,也是衡量一个项目产品好坏的第一道关口。 到底什么是前端 从最早的DOS系统说起,那时是没有前端的概念的,大多数的软件界面显示的都是冷冰冰的黑底白字的控制台命令,于是,慢慢的不仅是用户,就连广大的程序员也不满足现状,开发出一套图形化的用户界面,让一些功能更加便于操作。那时前端叫做GUI(图形用户界面)。还没有区分出多端的概念,大多数是基于操作系统开发出的原生界面。 上图来自DOS系统经典软件DOS Navigator 随着互联网的发展,第一代浏览器Netscape(网景浏览器)的诞生以及后续的IE系列浏览器的到来,”网上冲浪“这个词逐渐进入到大多数的用户生活中。直到现在大行其道浏览器Chrome,以及国内各种百花齐放的浏览器。主要给浏览器服务,实现各种特效的JavaScript语言,迎来了第一波春天。 上图来自网景浏览器 直到现在,前端逐渐拆分成:

Is it possible to access pre-set textureunits within a shader?

旧巷老猫 提交于 2021-02-11 15:31:16
问题 TL;DR: I've activated and bound textures to textureunits 1-4 and now I wish to use them within shaders without using a program specific uniform position. Is it possible to read data from textures using the "global" texture units? I'm having a bit of a hard time understanding how to access textures in webgl. Here in this tutorial on textures it says " Texture units are a global array of references to textures. ", and this sounds great. I've bound my textures using gl.activeTexture(gl.TEXTURE1

Is it possible to access pre-set textureunits within a shader?

﹥>﹥吖頭↗ 提交于 2021-02-11 15:31:10
问题 TL;DR: I've activated and bound textures to textureunits 1-4 and now I wish to use them within shaders without using a program specific uniform position. Is it possible to read data from textures using the "global" texture units? I'm having a bit of a hard time understanding how to access textures in webgl. Here in this tutorial on textures it says " Texture units are a global array of references to textures. ", and this sounds great. I've bound my textures using gl.activeTexture(gl.TEXTURE1

How to handle WebGL CONTEXT_LOST_WEBGL errors more gracefully in PixiJS?

别等时光非礼了梦想. 提交于 2021-02-11 04:58:26
问题 I have a React application that uses a data visualization library that uses PixiJS. I occasionally get frustrating CONTEXT_LOST_WEBGL errors in Chrome that force the user to manually reload the page, in order for the page to be (re)rendered. I cannot often or reliably reproduce the error, but I know that it happens as other people tell me the application occasionally shows no data. The situations that raise this error seem very context-dependent and therefore difficult to recapitulate — low

WebGL context is redrawn completely for no apparent reason

我是研究僧i 提交于 2021-02-10 20:14:05
问题 I'm experimenting with WebGL and it seems to me that I've missing something very basic but still can not find in docs and examples what exactly. So imagine I want to draw a rectangle, id do something like this: let points = rectangle(20, 20, 100, 100) gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, convertFloat32(points), WebGLRenderingContext.STATIC_DRAW) gl.drawArrays(WebGLRenderingContext.LINE_STRIP, 0, points.length) This works. I see a rectangle drawn an cannot be more happier. Same

WebGL context is redrawn completely for no apparent reason

老子叫甜甜 提交于 2021-02-10 20:12:49
问题 I'm experimenting with WebGL and it seems to me that I've missing something very basic but still can not find in docs and examples what exactly. So imagine I want to draw a rectangle, id do something like this: let points = rectangle(20, 20, 100, 100) gl.bufferData(WebGLRenderingContext.ARRAY_BUFFER, convertFloat32(points), WebGLRenderingContext.STATIC_DRAW) gl.drawArrays(WebGLRenderingContext.LINE_STRIP, 0, points.length) This works. I see a rectangle drawn an cannot be more happier. Same

Normals transformation for Back-Face culling

别说谁变了你拦得住时间么 提交于 2021-02-10 05:09:54
问题 Starting from this lesson here: WebGL 3D Perspective I am triyng to implement Back-Face culling no magic. I am computing on the fly the face normals in object space. After that, I am setting the fudgeFactor inside m[2][3] to get the perspective divide by Z . To check if the shear matrix works, I expanded my snippet using directly the vertex positions projected out of the WebGL vertex shader, and added the "projected position" flag. Now, I am triyng to use the z-component inside the

Normals transformation for Back-Face culling

别说谁变了你拦得住时间么 提交于 2021-02-10 05:08:19
问题 Starting from this lesson here: WebGL 3D Perspective I am triyng to implement Back-Face culling no magic. I am computing on the fly the face normals in object space. After that, I am setting the fudgeFactor inside m[2][3] to get the perspective divide by Z . To check if the shear matrix works, I expanded my snippet using directly the vertex positions projected out of the WebGL vertex shader, and added the "projected position" flag. Now, I am triyng to use the z-component inside the

ReadPixels from WebGL canvas

我们两清 提交于 2021-02-09 11:13:54
问题 I am trying to save an animation which is created with WebGL on this page. I'd like to store the RGBA values of the animation as an array on my hard drive. Therefore, I tried to use the readPixels method to access the data in javascript to save them. But there are always just zeros written into the array. I tried this code to read the data from the canvas c var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); gl.readPixels(0, 0, gl.drawingBufferWidth, gl

ReadPixels from WebGL canvas

两盒软妹~` 提交于 2021-02-09 11:12:56
问题 I am trying to save an animation which is created with WebGL on this page. I'd like to store the RGBA values of the animation as an array on my hard drive. Therefore, I tried to use the readPixels method to access the data in javascript to save them. But there are always just zeros written into the array. I tried this code to read the data from the canvas c var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); gl.readPixels(0, 0, gl.drawingBufferWidth, gl