Strange blue dots on small textures with glTexImage3D

Started by
3 comments, last by Fahrenheit451 18 years, 4 months ago
I noticed some strange blue pixels on the edges of terrain and at a far, so I assumed that there was a bug in my mipmap generation code. I turned off mipmapping and loaded each mipmap level into the texture looking for a problem, and strangely enough at level 5 there was a big blue dot on the texture. I spent a while looking for the bug and finding nothing I just put in a 'memset(data,0,bytes)' call in. All the lower levels turned black, but level 5 continued to have a blue dot on it (but with black everywhere else). I spent a while wondering what was going on and out of desperation I created a buffer of size bytes*2 (where bytes is the right size of bytes per pixel * width * height * depth) and set it to 0, then passed a pointer to that to glTexImage3D, and strangely enough I got all black. I'm somewhat confounded as to what's going on here, perhaps it has something to do with the fact that level 5 is 2x2x1; however I found nothing in the documentation about a minimum that that is below. The value of bytes is 12, the format is GL_RGB, type is GL_UNSIGNED_BYTE. Here is a picture of what's going on: Sorry to post so often, I spend at least a half hour (and often longer) messing with things before I post. Thanks, ~SPH EDIT: Interestingly if I create a buffer twice as large, set it to 0, then copy the correct image in at the beginning then I get this (only one tile drawn so that the pattern is clearer): [Edited by - ShmeeBegek on November 27, 2005 3:20:31 PM]
AIM ME: aGaBoOgAmOnGeR
Advertisement
mipmaps must go down to 1x1x1
how are u generating the mipmaps
* yourself
* glubuildmipmaps
* SGIS_GENERATE_MIPMAP (+ arb func)

i wouldnt recommend glubuldmipmaps (slow + also im not sure about its reliabilty with 3d data, does it even work?)
I'm building them myself as I said, but right now I'm just setting it to 0 (as the memset call above shows). Also I said that I don't have mipmapping enabled so it shouldn't matter, right now I'm just having an issue with glTexImage3D.

Thanks, ~SPH
AIM ME: aGaBoOgAmOnGeR

Solved it with the help of someone on IRC, turned out that since it was 3 bytes per pixel the rows weren't aligned and I had the GL_UNPACK_ALIGNMENT set to 4.

Just for future reference, ~SPH

AIM ME: aGaBoOgAmOnGeR
I had a similar problem applying a texture to my terrain, whereby I would get some odd coloured pixels along one edge. For me it turned out to be a problem of not setting GL_CLAMP_TO_EDGE for the procedural texture I was generating, and I was getting a slight wrap around effect.

F451

This topic is closed to new replies.

Advertisement