Note that there are some explanatory texts on larger screens.

plurals
  1. POConjugate Gradients on iPhone/iPad using OpenGL ES 2.0
    text
    copied!<p>I wrote this as a question in a comment but I feel it is worth its own question.</p> <p>I would like to build a conjugate gradients solver on the iPhone/iPad as it would open up a realm of new possibilities for GPGPU programming on these devices such as real time optical flow/real time simulations/real time finite elements.</p> <p>The very well written chapter from <a href="http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter44.html" rel="nofollow">GpuGems</a> explains how it can be done using floating point textures.</p> <p>The first problem I have encountered is that I havent managed to create a floating point render-to-texture. Perhaps I simply dont have the right parameters for my texture setup. For example this code succeeds on the first line but then fails on the second one with an GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error.</p> <pre><code>glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 256, 256, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureHandle, 0); </code></pre> <p>So, my question is how can I do render-to-floating-point-texture on iPhone/iPad?</p> <p>Alternatively is there another way to solve this problem? I thought one messy alternative would be to use floating point textures in a frag shader and then render the resulting 16bit half-float into a regular gl_FragColor in a fragment shader by simply storing its first 8 bits in the R and second 8 bits in the G of gl_FragColor. Then I could read these values back from the FB using glReadPixels and reinterpret them as half floats and transfer that data to a new texture and repeat the process. The obvious problem with this is that it requires a very wasteful round trip from the GPU back to the CPU and then back to the GPU and im pretty sure it wont give any speed improvement.</p> <p>Does anyone have any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload