Sign in to follow this  
ShmeeBegek

Strange blue dots on small textures with glTexImage3D

Recommended Posts

ShmeeBegek    196
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]

Share this post


Link to post
Share on other sites
zedzeek    528
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?)

Share this post


Link to post
Share on other sites
ShmeeBegek    196
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

Share this post


Link to post
Share on other sites
ShmeeBegek    196

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

Share this post


Link to post
Share on other sites
Fahrenheit451    498
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this