Re: NSGLImage doesnt open large images
Re: NSGLImage doesnt open large images
- Subject: Re: NSGLImage doesnt open large images
- From: Alex Eddy <email@hidden>
- Date: Thu, 10 Mar 2005 19:36:14 -0800
On Mar 10, 2005, at 5:01 PM, Pradeep Kumar wrote:
I have been trying to use NSGLImage sample code provided by Apple. It
works fine for small
images (less than 2300pixs width). But for larger images (> 2400 pixs)
it gives an error
WARNING: OpenGL Error 0x501 while loading texture with glTexImage2D()
Does anyone know why this is happening? I am new to openGL.
It seems the minimum texture size is 16x16. For the images that are
displayed garbled, the
size was not a multiple of 16. All images that are multiples of 16 and
less than 2048 display
correctly. Other images dont display.
There has been some partial and misleading information in some of the
other replies, so let me briefly summarize:
* when submitting texture data, you are responsible for ensuring the
texel type, format, and rowbytes are correct. Read the glPixelStore and
glTexImage2D man pages. See in particular GL_UNPACK_ALIGNMENT and
GL_UNPACK_ROW_LENGTH.
* maximum texture size in OpenGL is hardware dependent. If you need to
display images larger than the hardware supports, you have to tile. See
http://developer.apple.com/samplecode/OpenGL_Image/OpenGL_Image.html
* supported texture formats and targets are hardware dependent. Some
old hardware only supports textures with power-of-two dimensions. There
are various gotchas for using rectangle texture targets efficiently,
see
http://developer.apple.com/samplecode/TextureRange/TextureRange.html
* see http://homepage.mac.com/arekkusu/bugs/GLInfo.html for what
hardware supports what. Keep in mind that the reported max texture
limits are only a guideline-- whether a texture will actually be valid
or not depends on the hardware and the texel format (a greyscale
2048x2048 texture has a better chance of fitting in VRAM than a RGBA
2048x2048 texture.) Read up about GL_PROXY_TEXTURE_2D.
Finally, bringing this a bit back on topic for cocoa-dev, I think one
of the benefits of CoreImage in Tiger is to shield the developer from
the gory details of OpenGL. Unfortunately, if you want to do this in
10.3 you're going to have to get your hands dirty. The mac-opengl list
is better suited to followup questions.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden