glTexImage2D subtlety?

w_reade
Unregistered
 
Post: #1
This worked on Jaguar:

Code:
glGenTextures(1, &GLid);
    glBindTexture(GL_TEXTURE_2D, GLid);
    if (mipmap)
        gluBuild2DMipmaps(GL_TEXTURE_2D,
                          GL_RGBA,
                          width,
                          height,
                          GL_BGRA,
                          GL_UNSIGNED_INT_8_8_8_8_REV,
                          buf);
    else
        glTexImage2D(GL_TEXTURE_2D,
                     0,
                     GL_RGBA,
                     width,
                     height,
                     0,
                     GL_BGRA,
                     GL_UNSIGNED_INT_8_8_8_8_REV,
                     buf);

Now, under Panther, it doesn't.

More specifically, glTexImage2D() just produces an opaque white texture, while gluBuild2DMipmaps() still works as expected.

Am I ignoring some subtle requirement somewhere? The textures are all Po2 square...
Quote this message in a reply
Member
Posts: 156
Joined: 2002.11
Post: #2
I think I've seen this problem being addressed in a previous thread, just a few weeks ago. There was a work-around on that thread... if I only could find it.

If I recall it correctly, it has something to do with the OpenGL defaults for the functions, which didn't work right on versions of OS X previous to Panther.

The fix is to set up the correct parameter to override the default setting for that function.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

(texture min filter defaults to NEAREST_MIPMAP_LINEAR or something equally absurd. Under previous versions of the Mac OS, it was treated as LINEAR if there were no mipmaps. On Panther, it's (correctly) treated as invalid.)
Quote this message in a reply
w_reade
Unregistered
 
Post: #4
Ah, thanks. Fixed now. Cheers.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  how to use Glubuild2DMipmaps, GlTexImage2D and glTexParameter 007gamer 1 4,254 Jan 31, 2007 04:36 AM
Last Post: OneSadCookie
  glTexImage2D bug? Skorche 1 2,868 Apr 12, 2005 01:28 AM
Last Post: OneSadCookie
  glTexImage2D formats clarification WhatMeWorry 1 4,246 Nov 17, 2004 01:31 AM
Last Post: arekkusu
  Issue with glTexImage2D? Mars_999 5 4,373 Oct 21, 2004 05:06 PM
Last Post: Mars_999
  glTexImage2D() and single colour component textures sealfin 3 4,449 Aug 10, 2004 04:45 AM
Last Post: arekkusu