cancel
Showing results for 
Search instead for 
Did you mean: 

Using a single float texture to pass to a GLSL shader (GL_R32F not available)

jhaelin
Honored Guest
Hi,

a hardware component delivers me single float textures, which I want to pass in the shader to modify my geometry. Unfortunately, I am not sure how I can do that with the Oculus SDK. I'm using the Oculus SDK version 1.8.0 (with OpenGL 4.5).
But I’m unsure how I need to change the following line, which works for a 4 uchar texture:


glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1280, 720, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);


I would change the first GL_RGBA to GL_R32F (see doc), the 2nd to
GL_RED since it’s one channel and GL_UNSIGNED_BYTE to GL_FLOAT:



glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, 1280, 720, 0, GL_RED, GL_FLOAT, NULL);


https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml



But GL_R32F is not available for me in the Oculus SDK. Can you give me any pointers? I've looked for the definition of it in the SDK, but I couldn't find it. Using GL_RGBA instead just gives me "interpret float as 4 uchar" noise.


This is basically a duplicate of my stackoverflow question, but here there are more knowledgable people, I assume.
http://stackoverflow.com/questions/43087640/using-a-single-float-texture-in-opengl-with-the-oculus-s...


2 REPLIES 2

kojack
MVP
MVP
Based on your stack overflow question...







I am not displaying it - I am
passing it to a shader to modify my geometry. The float texture is
given to me via hardware. Correct me if I'm wrong, but I think in
"CAPI_GLE_GL.h" the Oculus SDK defines a minimal wrapper for OpenGL
support, which intercepts OpenGL calls basically. The specified "sized
internal format" is not available to me.

The oculus sdk doesn't intercept opengl calls, you can render like normal for the most part. You need the oculus provided texture to render into, but you can make your own textures for other uses like normal.



jhaelin
Honored Guest
Thanks for the clarification. Does the SDK provide regular OpenGL or do I need to include sth else like GLEW to use the aforementioned declarations?