You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a WebGLRenderTarget with RGIntegerFormat a WebGL error occurs: WebGL: INVALID_VALUE: texImage2D: invalid internalformat or (GL_INVALID_OPERATION: Fragment shader output type does not match the bound framebuffer attachment type.). Managed to fix the issue by adding the follwing code to this function:
if ( glFormat === _gl.RG_INTEGER ) {
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;
if ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;
if ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;
if ( glType === _gl.INT ) internalFormat = _gl.RG32I;
}
Not sure if this is the only place this is needed?
Reproduction steps
Create a WebGLRenderTarget with RGIntegerFormat and RG8UI internal format.
Would you mind filing a PR with your fix? The addition looks correct. getInternalFormat() is the only place where something is missing for supporting RGIntegerFormat.
BTW: In your fiddle, you are not creating the instance of WebGLCubeRenderTarget correctly. The ctor has only two parameters, not three. Besides, position shader attributes are not of type vec4 but vec3.
In any event, adding your code makes the fiddle work without errors.
Fixed the WebGLCubeRenderTarget construction in the fiddle for posterity: https://jsfiddle.net/h3e4zncb/1/
The position attribute is vec4, I'm using a RawShaderMaterial. Even if the underlying buffer data is vec3, WebGL will automatically set the 4th component to 1.0.
Unspecified y and z components are implicitly set to 0.0 for floating-point array types and 0 for integer array types.
Unspecified w components are implicitly set to 1.0 for floating-point array types
and 1 for integer array types.
Description
When creating a
WebGLRenderTarget
withRGIntegerFormat
a WebGL error occurs:WebGL: INVALID_VALUE: texImage2D: invalid internalformat
or (GL_INVALID_OPERATION: Fragment shader output type does not match the bound framebuffer attachment type.
). Managed to fix the issue by adding the follwing code to this function:Not sure if this is the only place this is needed?
Reproduction steps
WebGLRenderTarget
withRGIntegerFormat
andRG8UI
internal format.Code
jsfiddle
Live example
jsfiddle
Screenshots
No response
Version
r160
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: