I’m trying to write a shader that uses many bit operations. In fact they are supported since glsl 1.30, but I’m only on OpenGL 2.1.
Is there any way to use bit operations with my OpenGL version?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All SM3 compatible (~OpenGL 2.1) hardware supports limited integer functionality. This is usually done by emulating integers with floats and does not include bit operations.
For bit operations, you need either GLSL 1.3 or EXT_gpu_shader4.
If the reason that you have only OpenGL 2.1 is that your driver is somewhat outdated, you may be lucky to still have EXT_gpu_shader4 (updating drivers might be a good idea though, in that case).
If the reason is that your graphics card simply does not support anything better, you are out of luck.
If you do have EXT_gpu_shader4 (check extension string), you can add:
to your GLSL 1.2 shaders, and it should work.