Hi all,
I work on a program using OpenGL ES3.0 and I would like to do bit-wise shift on texture data. I can't render anything when I specify my texture as GL_RGB8UI and GL_RGB_INTEGER. But for GL_RGB8 and GL_RGB it works, I render an image but I can't perform a bit-wise shifting because it is not integer's data.
So I am asking if integer texture is supported on this gpu. I saw that an extension exists for this but it is not listed in the imx6 Graphics User Guide.
Thanks for your help.
Anthony
Hi Anthony,
bitwise texture data with GL_RGB8UI and GL_RGB_INTEGER should works . however make sure that you are not using fixed functions, for fixed functions you should use shaders. In any case it looks like GL_RGB8 and GL_RGB works is because you are rendering textures images at 16-bit alignment.
Regards
Hi, and sorry for my late answer (I got problem on other project).
I think my problem could not be one but just a missing knowledge of openGL, but I will describe what I really want to do and my problem.
I would like to access texture value in the fragment shader to do bitwise operations. More precisely I would like to transform Input(R,G,B) to Output(R, G, (R&0xF0)|(G&0xF0)>>4).
To do this I would like to access my texture value as integer and not float as it is by default.
To do this I use a FBO and I configure it like this :
glGenFramebuffers(1, &m_uiFrameBufferObject);
glBindFramebuffer(GL_FRAMEBUFFER, m_uiFrameBufferObject);
glGenTextures(1, &m_uiTextureFB);
glBindTexture(GL_TEXTURE_2D, m_uiTextureFB);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8UI, WIDTH, HEIGHT, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_uiTextureFB, 0);
And then I do a render to texture with a texture configure like this :
glGenTextures(1, &m_uiTextureId);
glBindTexture(GL_TEXTURE_2D, m_uiTextureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, WIDTH_IN, HEIGHT_IN, 0, GL_RED, GL_UNSIGNED_BYTE, ucImage);
When I check the frame buffer, I have the error : GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
And it works if my texture is GL_RGB and not GL_RGB8UI. But when I read the open gl es 3.0 spec it is written that GL_RGB8UI is not color renderable so this is why it doesn't work.
I will try with GL_RGBA8UI which is color renderable and I see if it's OK.
Thanks for your time.