Jump to content
  • Advertisement
Sign in to follow this  
Akilan Thangamani

OpenGL Display 16-bit huge mage

This topic is 3790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I tried to display huge image using openGL library. As the width and height is restricted to 2^n, I scaled the size with glScaleImage(..) and and tried to display by glTexImage2D(..). It displays complete white.. Moreover my image size is 16-bit/pixel variety. Can anyone give me the solution????

Share this post

Link to post
Share on other sites
What image size are you saying is huge?
OpenGL on modern H/W can handle texture images of 4K x 4K and the new NVidia 8800 series can handle 8K x 8K. Many other cards cannot.
In addition - there may be different limits depending upon if the texture is square texture or not. Typcially, many OGL cards have smaller texture size support for non-square textures.

So- first you should determine a sensible minimum size your application is going to support. You can determine this at runtime by using:

Some c# example code below - which will report the max texture size for Cubes, 3D textures, regular square textures and rectangle textures.

int iMaxTexture3DSize, iMaxTexture2DSize, iMaxTextureCubeSize, iTexMaxRectSize;
glGetIntegerv (GL_MAX_3D_TEXTURE_SIZE, out iMaxTexture3DSize);
glGetIntegerv (GL_MAX_TEXTURE_SIZE, out iMaxTexture2DSize);
glGetIntegerv (GL_MAX_CUBE_MAP_TEXTURE_SIZE, out iMaxTextureCubeSize);
glGetIntegerv (GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, out iTexMaxRectSize);

If your huge texture will not fit - consider uploading only a viewable portion. For example: suppose your source data image is 10k x 10k. Create a dyanmic 1k x 1k opengl texture and upload a chunk (or a tile) of your source data to the opengl texture. When the user 'requests' to view the next tile - use opengl and a data pointer to your original image data to upload the next tile and so on.

Some simple code to create a dynamic texture is:

iWidth = iHeight = 1024;
int format = GL.GL_RGBA; // initial value
int target = GL.GL_TEXTURE_2D; // E.G. GL_TEXTURE_2D
Gl.glGenTextures (1,out iTextureID);
Gl.glBindTexture(target, iTextureID);
int errorCode = Gl.glGetError();

Gl.glTexParameteri(target, Gl.GL_TEXTURE_WRAP_R, Gl.GL_CLAMP_TO_EDGE);
Gl.glTexParameteri(target, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP_TO_EDGE);
Gl.glTexParameteri(target, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP_TO_EDGE);
Gl.glTexParameteri(target, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST);
Gl.glTexParameteri(target, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST);

Gl.glTexImage2D (Gl.GL_TEXTURE_2D,0,format,stInfo.iWidth,stInfo.iHeight,0,baseType,iMappedDataType,IntPtr.Zero);

Now .. to update a chunk of this texture you simply call glTexCopy2D() or one of its variants.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!