• OpenGL glTexImage2D sometimes creates an opaque white texture ?

    From R.Wieser@21:1/5 to All on Fri Mar 18 17:57:39 2022
    Hello all,

    I've been using OpenGL to show some scenery, and am adding textures (while loading the models) using the glTexImage2D call (which takes raw pixels).

    The problem is that just a few textures of the 80 I add turn out to be a
    fully opaque white*. However, when I pre-load such a texture it turns out fine.

    * in the loaded model as well as in a debugging model in which I display all loaded textures as squares in a grid (read: its not a problem just of the model).

    an glGetError call just after the glTexImage2D one always shows Zero (no
    error)

    And oh yeah, the effect seems to be static. I've ran the program a number
    of times and even on different days (rebooting the 'puter) in between, but
    its always the same textures that go wrong.

    I've also tried to change the raw pixel data for all textures to fully transparent just before calling glTexImage2D, but the opaque white textures stayed - which seems to indicate that its really related to the glTexImage2D call.

    The question is, what can be causing it ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sun Mar 20 11:29:49 2022
    The problem is that just a few textures of the 80 I add turn out to be
    a fully opaque white*. However, when I pre-load such a texture it turns
    out fine.

    Trying to isolate what circumstances cause it I found that putting just the glTexImage2D inside a glNewlist, glEndlist pair causes the effect to happen.

    Which is rather odd as I load all other, looking OK, images the exact same
    way.

    Also, glGetError keeps returning an OK status before and after calling each
    of the above three functions.

    I also checked if its actually the glTexImage2D function, by directly after
    it using glGetTexImage. On most textures I get back what I offered to glTexImage2D, but on the problematic ones the targtet "pixel" buffer doesn't get touched - but still the glGetError call after the glGetTexImage one
    returns an OK status ...

    I have /no/ idea what is going on here. Help ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Mon Mar 21 12:16:26 2022
    I have /no/ idea what is going on here. Help ?

    After a few days of testing, trying to make sense of seemingly inconsistent results, I found in which circumstances it happened and from there the why
    of it. A quick succesfull "that means if I do {this} (a hack) my problem should disappear" test seemed to confirm it. With that in hand looking at
    the involved functions gave me lead on what to change to fix it.

    Bottom line : creating textures within a displaylist (glNewList) and sharing those textures with other displaylists comes with a few gotyas - none of
    them described in the MSDN pages to the involved functions.

    And ofcourse, looking back the problem and its solution do seem to be quite obvious.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)