Hello,
I have been creating height maps on the GPU with a framebuffer object. Once the height map texture is captured I attempt to sample the center of it (for LOD purposes) with an ImageRaster yet the color at the point always returns with (0,0,0,0) which is impossible… I was wondering if there was a way to get the color of a pixel on a texture that had it’s data created on the GPU. Thanks for any suggestions…this is the last thing I am struggling with for my terrain renderer…
…saves the whole frame buffer to a file so I imagine it manages to get the pixel values correctly. Maybe it’s code is helpful.
@pspeed said: This class: http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/state/ScreenshotAppState.java…saves the whole frame buffer to a file so I imagine it manages to get the pixel values correctly. Maybe it’s code is helpful.
Oh ok thanks. I can probably use renderer.readFrameBuffer() to get a byte buffer, create a rastered image with it, and then sample it that way to get the information I need. Thanks for the help!
@pspeed said: This class: http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/state/ScreenshotAppState.java…saves the whole frame buffer to a file so I imagine it manages to get the pixel values correctly. Maybe it’s code is helpful.
Yea so after trying this it appears that the buffer I get is filled with NaNs…is there any glReadPixels like functionality in JMonkey>
Did you make a copy of the buffer or just use a reference? The buffer can get cleared at any-time and if you are only using a reference, it too will get cleared.