Pryme8 Posted July 26, 2018 Share Posted July 26, 2018 Is it possible to pass a texture, a dynamic texture, or even better a material to a GUI button? I know I could convert the texture to an image, but I was hoping to skip a step. texture.update() /*-- Create Image --*/ var canvas = document.createElement('canvas') canvas.width = size.x, canvas.height = size.y var tCtx = canvas.getContext('2d') var iDat = ctx.getImageData(0,0,size.x, size.y) tCtx.putImageData(iDat, 0,0) var image = new Image() image.id = "GUI-Image" image.src = canvas.toDataURL() texture.rawImage = image; Is what I am doing right now. Ideally I would want to be able to assign a rtt, to a Image on a button on the GUI. With the intent of raymarching some GUI elements but using the GUI's structure to organize and deal with mouse interaction. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 27, 2018 Share Posted July 27, 2018 GUI is canvas based so there is no webgl involved. So no material or texture. So you need to read pixels (texture.readPixels) and use that to draw in your canvas. Should not be a problem if you don't that too much as it involves GPU->CPU memory transfer Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 27, 2018 Author Share Posted July 27, 2018 thanks what I was kinda thinking! Thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.