Having a problem with texturing vertices in WebGL, think parameters are off in the image?
Posted
by
mathacka
on Game Development
See other posts from Game Development
or by mathacka
Published on 2013-10-27T20:30:37Z
Indexed on
2013/10/27
22:02 UTC
Read the original article
Hit count: 436
I'm having a problem texturing a simple rectangle in my WebGL program, I have the parameters set as follows:
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, textureImage);
I'm using this image:
On the properties of this image it says it's 32 bit depth, so that should take care of the gl.UNSIGNED_BYTE, and I've tried both gl.RGBA and gl.RGB to see if it's not reading the transparency. It is a 32x32 pixel image, so it's power of 2. And I've tried almost all the combinations of formats and types, but I'm not sure if this is the answer or not.
I'm getting these two errors in the chrome console:
INVALID_VALUE: texImage2D: invalid image (index):101
WebGL: drawArrays: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled.
the drawArrays function is simply: "gl.drawArrays(gl.TRIANGLES, 0, 6);" using 6 vertices to make a rectangle.
© Game Development or respective owner