Skip to content
Advertisement

Tag: webgl

Multiple passes render to separate textures

I am using the render to texture method for creating a multi shader program. And for various reasons. I need to first render a model to a texture with one shader program. Then render it again with a different shader program into a different texture. Then I have one final post processing shader that combines the results of the two.

webgl trying to draw a triangle

I have been trying to draw a triangle but it is not showing up on the canvas here is my draw function code: here is the whole work: Answer There are some issues: The properties gl.viewportWidth and gl.viewportHeight are never set: In the array of vertex coordinates is a , instead of a . And there is a typo ,

Phong and Gouraud Shading WebGL

I read that that in Gouraud Shading, the color for the fragment is computed in the Vertex Shader. Whereas, in Phong Shading, the color for the fragment is computed in the Fragment Shader. In this implementation , which of these are we using ? I did not understand exactly the difference between them. Could anyone help me ? Thanks Answer

WebGL – cannot reader property createShader of null

I am following a book called professional WebGL, I am hand writing stuff making sure of my understanding, I have this code: for some reason, it says that it can’t read property null for createShader here: shader = gl.createShader(gl.VERTEX_SHADER); But it doesn’t complain at all for the same declaration but with the fragment shader. Answer Slightly changed version. gl.celar was

WebGL: get error/warning message text as a string

When an error occurs within WebGL, a warning message is usually displayed in the browser’s console. For example, trying to create a texture which is too big: Chrome and Safari display this warning message in the console: Firefox displays this warning message: How can I programmatically obtain this message from WebGL? I’m looking for something like gl.getErrorMessage() which would return

Advertisement