c++ - Need to create a custom data 2D texture with reasonable precision -


the idea

i need create 2d texture fed resonably precise float values (i mean @ least precise glsl mediump float). want store in each pixel's distance camera. don't want gl zbuffer distance near plane, own lovely custom data :>

the problem/what i've tried

  • by using standard texture color attachment, don't enough precision. or maybe missed ?

  • by using depth attachment texture gl_depth_component32 getting clamped near plane distance - rubbish.

so seems stuck @ not using depth attachment tho seem hold more precision. there way have mediump float precision standard textures ?

i find strange opengl doesn't have generic container arbitrary data. mean custom bit-depth. or maybe missed again!

you can use floating point textures instead of rgba texture 8 bit per pixel. support of these depends on devices want support, older mobile devices have lack of support these formats.

example gl_rgba16f( not tested ):

glteximage2d(gl_texture_2d, mipmap, gl_rgba16f, mipmapwidth, mipmapheight, gl_rgba, gl_half_float, null); 

now can store data in fragment-shader manually. clamping still occurs depending on mvp. need pass data fragment shader.

there 32bit formats.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -