Resizing the texture in memory
I'm sitting here wondering if it is possible to resize the texture based on image data already loaded? Code-wise the resizing would ideally take place between glGenTextures and glBindTexture and glTexImage2D.
I've been scanning through OpenGL references but I can't seem to find anything. Either there isn't one or my eyes are getting too sore :-/
Quote:Original post by _necrophilissimo_There isn't one. You can emulate this by allocating a new texture with the new size, and then using some form of render-to-texture (preferably FBO) to render the old texture into the new one with appropriate scaling.
I'm sitting here wondering if it is possible to resize the texture based on image data already loaded? Code-wise the resizing would ideally take place between glGenTextures and glBindTexture and glTexImage2D.
I've been scanning through OpenGL references but I can't seem to find anything. Either there isn't one or my eyes are getting too sore :-/
Quote:Original post by swiftcoder
There isn't one. You can emulate this by allocating a new texture with the new size, and then using some form of render-to-texture (preferably FBO) to render the old texture into the new one with appropriate scaling.
Thanks for the tip, but I already concidered that, but I cant go down that path; The whole purpose of this endevour of mine is to find a work-around to some videocards not accepting GL_TEXTURE_RECTANGLE extensions. The idea is to allow people using such cards to downscale the textures to power-of-2 dimensions. Render-to-texture doesn't work if the videocard can't render the texture, not to mention using FBO would force me to use even more extensions videocards of those users can't handle.
So, is there any other option (other than re-scaling the textures files or re-writing the actual image file reading routines)?
Quote:Original post by _necrophilissimo_Do what gluBuild2DMipmaps does - rescale in software before uploading the texture to OpenGL.
So, is there any other option (other than re-scaling the textures files or re-writing the actual image file reading routines)?
If you want to scale, here is one way
glhScaleImage_asm386
http://www.geocities.com/vmelkon/glhlibrary.html
glhScaleImage_asm386
http://www.geocities.com/vmelkon/glhlibrary.html
Quote:Original post by _necrophilissimo_To be honest, that is some truly ancient hardware you are targeting - the GeForce 2 MX had support for GL_ARB_texture_rectangle, as does my old Radeon 7000 mobility. Anything a couple of revisions newer than those two should support GL_ARB_texture_non_power_of_two as well...
Thanks for the tip, but I already concidered that, but I cant go down that path; The whole purpose of this endevour of mine is to find a work-around to some videocards not accepting GL_TEXTURE_RECTANGLE extensions. The idea is to allow people using such cards to downscale the textures to power-of-2 dimensions.
Thanks, I'll look into all the options :)
Well, yeah, I'm aiming at very low end. Judging by the feedback I've been getting surprisingly many people have faced issues ragarding the matter. The biggest offenders seem to be the integrated Intel Graphics chips. Apparently those things can run Vista Premium but can't handle rectangle OpenGL textures :-/
Quote:Original post by swiftcoder
To be honest, that is some truly ancient hardware you are targeting - the GeForce 2 MX had support for GL_ARB_texture_rectangle, as does my old Radeon 7000 mobility. Anything a couple of revisions newer than those two should support GL_ARB_texture_non_power_of_two as well...
Well, yeah, I'm aiming at very low end. Judging by the feedback I've been getting surprisingly many people have faced issues ragarding the matter. The biggest offenders seem to be the integrated Intel Graphics chips. Apparently those things can run Vista Premium but can't handle rectangle OpenGL textures :-/
Quote:Original post by _necrophilissimo_The Intel GMA X3100, X3500 and X4500 all support texture_rectangle, but sadly the very common GMA 950 does not.
Well, yeah, I'm aiming at very low end. Judging by the feedback I've been getting surprisingly many people have faced issues ragarding the matter. The biggest offenders seem to be the integrated Intel Graphics chips. Apparently those things can run Vista Premium but can't handle rectangle OpenGL textures :-/
However, you might want to consider why you need to use rectangular textures at all. The primary use of rectangular textures is usually render-to-texture, as they allow you to match the native dimensions of the back-buffer. Since the 950-class GMAs aren't really up to much render-to-texture, I assume this is for loaded textures instead, at which point you might as well use power-of-2 textures on *all* systems (and store the images that way).
Also keep in mind that many GPUs which claim to support rectangular textures (in particular, older ATI cards) take a *huge* performance hit (> 1200%) when sampling from rectangular textures.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement