WebGL and Javascript...

Started by
2 comments, last by Yours3!f 12 years, 3 months ago
Hello guys.smile.png

I'm writing a web project with web-gl support. So, I have these questions:


"deleteBuffer,deleteTexture,... on WebGL ?"
[/quote]


var texture = gl.createTexture();
// setup...
// using...
texture = null; // does it removes from GPU or not??? It's a javascript machine (I think it should contain a destructor when object removing)...




"Framebuffer: COLOR_ATTACHMENT0 exists on specification but COLOR_ATTACHMENT1 is not..."
[/quote]
So, is this means that mrt (Multiple Render Targets) is not supported?


Also, looks like it doesn't support depth/stencil textures. Is it true?

Best wishes, FXACE.
Advertisement


"Framebuffer: COLOR_ATTACHMENT0 exists on specification but COLOR_ATTACHMENT1 is not..."

So, is this means that mrt (Multiple Render Targets) is not supported?


Also, looks like it doesn't support depth/stencil textures. Is it true?

Best wishes, FXACE.
[/quote]

as far as I know in both OpenGL ES and WebGL MRT is not supported by the specification.

according to this:
OpenGL ES 2.0 §4.4.3

(as suggested on the WebGL specification page under the FramebufferRenderbuffer function)

color attachments other than the 0th are NOT supported. So you have to do multipass rendering if you still want to use this functionality.

according to this:
OpenGL ES 2.0 §3.7.1

you can only create (with TexImage2D) RGBA, ALPHA, and LUMINANCE textures, so depth and stencil texture creation isn't supported. You can only create FBOs with these (depth, stencil) attachments (and I think renderbuffers too), but still the attached textures can't have the hardware supported GL_DEPTH_COMPONENT as internal format.

according to this:
OpenGL ES 2.0 §3.7.13

you can use
void deleteTexture(WebGLTexture texture)
for deleting textures.

here's the online specification:
https://www.khronos.org/registry/webgl/specs/1.0

you can see that in a lot of places it refers to the OGL ES specification, but if you're concerned about the differences just look them up in the table of contents.

I tried to be as precise as I could, but if I'm wrong correct me :)

you can use
void deleteTexture(WebGLTexture texture)
for deleting textures.
[/quote]
Definitely, I can use them (if they are there). But I did mean:

1:

var texture = gl.createTexture();
gl.deleteTexture(texture);

2:

var texture = gl.createTexture();
texture = null;


Are these commands not the same? (Is there, in the second tag of code, possible a memory leak on devices?)

What about WebGL specification I can say I'm already hold it on my hands.


+ 1 question:
Is WebGL updating (new features, functionality,...) or it just staying on it's place?


Anyway, I put 'like' to your post, Yours3!f, as thanksgiving to your attention.

Best wishes, FXACE.
according to this:
OpenGL ES 2.0 §3.7.13

var texture = gl.createTexture();
only means that you have created a texture, and stored its ID (in variable texture), which is not the same as its memory address. Plus in the specification the 2nd way isn't mentioned anywhere. To add you can easily find out if after either method the texture still exists via
GLboolean isTexture(WebGLTexture texture);
(OpenGL ES 2.0 §6.1.4)
Yes I do think that using the 2nd version would lead to memory leak.

The only WebGL specification is the one I mentioned in my previous post. I think its not in the usual format (pdf) because of the technology being "web".

I think they will keep updating it, but I'm not sure. They look pretty enthusiast about it, you can even find a spinning WebGL based cube on khronos.org. I'd be a huge mistake to discontinue a technology that has no competitors.

Anyway, I put 'like' to your post, Yours3!f, as thanksgiving to your attention.[/quote]
You're welcome! I'm trying to master the GL/CL specifications like it was a book of Laws.

This topic is closed to new replies.

Advertisement