0

I knew from a website that rectangle texture can be used for screen-sized images. However, for the function glGetTexParameterfv, only GL_TEXTURE_2D and GL_TEXTURE_CUBE_MAP are accepted. Does it mean that rectangle texture, or GL_TEXTURE_RECTANGLE, is not supported by OpenGL ES 2.0? And I am wondering whether it means only normalized texture coordinate can be used in shaders? Thank you.

keaukraine
  • 5,315
  • 29
  • 54
Timothy
  • 469
  • 1
  • 5
  • 19

1 Answers1

0
  • About GL_TEXTURE_RECTANGLE

  • Texture coordinates is just a interpolated value between vertices. But for 2D texture it's value in 0.0 to 1.0 range (if you do not tiling texture). For texture cube its vector (it can be non-normalized)

Community
  • 1
  • 1
JAre
  • 4,666
  • 3
  • 27
  • 45
  • Thank you for your help. I am wondering if a non-normalized vector is used as texture coordinates, what is the precision? – Timothy Nov 25 '12 at 16:25
  • @Timothy final precision is defined by [sampler](http://www.opengl.org/wiki/Sampler_(GLSL)) and precision parameters [paragraph 4.5](http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf). – JAre Nov 25 '12 at 17:20
  • @Timothy I mean you can't make sampler more precise than defined shader precision. But you can split your textures or do something with txture coordinates before passing them to sampler (like splitting to Integer and fractional parts and then combining in fragment shader) to avoid losing precision due to hight number operations. – JAre Nov 25 '12 at 17:44
  • Thank you @JAre. But I am still a little confused about it. For example, given a texture of the size 2048 * 2048, if I use a normalized vector to sample the texture, the precision is 2^-10 and as a result, it is impossible for me to sample all the pixels. However, if the vector is not normalized, although the precision is still 2^-10, all the pixels of the texture is accessible because another 5 bits of exponent can be used to sample the image. So I am wondering if it is possible for me to sample a texture in this way so that higher resolution will be achieved? – Timothy Nov 25 '12 at 17:48
  • I also thought about splitting the texture into small pieces and I have started reconstructing part of the program. But it would be rather exhausting because I would have to change a lot of codes. So I am seeking for a method to deal with the problem. – Timothy Nov 25 '12 at 18:08
  • Might be you can solve texture size limitation with [MegaTexture](http://en.wikipedia.org/wiki/MegaTexture) it also was implemented on WebGL [link](http://www.noxa.org/blog/2009/11/29/megatextures-in-webgl-2/) – JAre Nov 25 '12 at 18:43
  • Do you know whether MegaTexture is available for OpenGL ES 2.0? Thank you – Timothy Nov 26 '12 at 00:32
  • And also it seems that this technique is used for reducing the use of memory. Will it work when I am encountered with the problem of resolution? – Timothy Nov 26 '12 at 01:23
  • @Timothy Megatexture used for displaying extremely large textures so lvl designers will be able to make each bit of lvl unique. It's hungry for memory\bandwidth so i don't know about mobile devices usage but if you need to display large texture you may try to display its megatexture instead. Read about [clipmapping](http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter02.html) it's basis. – JAre Nov 26 '12 at 11:26
  • 1
    Well, I see. Thank you for your kind help and I will go to see whether Megatexture will work. Thank you! – Timothy Nov 26 '12 at 14:18