Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OpenGL glTexImage2D sometimes creates an opaque white texture ?

19 views
Skip to first unread message

R.Wieser

unread,
Mar 18, 2022, 12:57:56 PM3/18/22
to
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


R.Wieser

unread,
Mar 20, 2022, 6:30:11 AM3/20/22
to

> 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


R.Wieser

unread,
Mar 21, 2022, 7:16:41 AM3/21/22
to

> 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


0 new messages