Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing a RenderedTexture throws an error. #1231

Open
microaaron opened this issue Aug 10, 2022 · 1 comment
Open

Removing a RenderedTexture throws an error. #1231

microaaron opened this issue Aug 10, 2022 · 1 comment

Comments

@microaaron
Copy link
Contributor

Here is an example, it comes from #362. I didn't find any tutorial about RenderedTexture.
https://jsitor.com/zj0PlU9Md

Uncaught TypeError: Failed to execute 'deleteFramebuffer' on 'WebGL2RenderingContext': parameter 1 is not of type 'WebGLFramebuffer'.
at rt_tex._cleanupGLObjects (x3dom.debug.js:16502:25)

{gl.deleteFramebuffer( this._webgl.fbo.rbo );}

<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<script type="text/javascript" src="https://x3dom.netlify.app/x3dom.debug.js"></script>
	<link rel='stylesheet' type='text/css' href='https://x3dom.netlify.app/x3dom.css' />
	<title></title>
	<style type="text/css">
		body {
			font: 13px/18px Arial, sans-serif;
			background: black;
			color: white;
		}
	</style>
</head>

<body>
	<x3d id="x3d" showStat="false" showLog="true" x="0px" y="0px" width="900" height="900px">
		<scene id="SCENE" DEF="SCENE">
			<shape>
				<appearance sorttype="auto" alphaclipthreshold="0.1">
					<RenderedTexture DEF="RenderedTexture" id="RenderedTexture" update="always" dimensions="256 256 4">
						<Shape USE="shape" containerField="excludeNodes"></Shape>
						<Viewpoint containerField="viewpoint" position="0 0 5"></Viewpoint>
						<Group>
							<Shape>
								<Appearance>
									<Material diffuseColor="1 1 0" transparency="0.5"></Material>
								</Appearance>
								<Sphere></Sphere>
							</Shape>
						</Group>
						<TextureProperties boundaryModeS="CLAMP_TO_EDGE" boundaryModeT="CLAMP_TO_EDGE"
							magnificationFilter="NEAREST" minificationFilter="NEAREST" generateMipMaps="false">
						</TextureProperties>
						</RenderTexture>
				</appearance>
				<box solid="true" ccw="true" usegeocache="true" lit="true" size="2,2,2"></box>
			</shape>
		</scene>
	</x3d>

	<script>
		setTimeout(() => {
        document.getElementById("RenderedTexture").remove();
      }, 2000);

	</script>
</body>

</html>
@microaaron
Copy link
Contributor Author

microaaron commented Aug 11, 2022

@andreasplesch
this._webgl.fbo.rbo is a WebGLRenderbuffer.

Similar codes here.

{gl.deleteRenderbuffer( this._webgl.fbo.rbo );}

microaaron added a commit to microaaron/x3dom that referenced this issue Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant