Weird Moiré pattern when generate texture for cubemap

Hi, I’m attempting to make a star field for a solar system scene I’m generating.

My code is in this repo:

I’m using ofxCubeMap (


I modified ofxCubeMap slightly, so I’ve included the modified version in my repo.

I modified ofxCubeMap by adding a function called ofxCubeMap::loadFromPixels(). It functions exactly the same as the ofxCubeMap::loadImages() Andreas uses in the example on his repo. The one difference in the function I added, is it takes as it’s arguments unsigned char pointers. loadImages takes paths to images as it’s arguments, and loads them as ofImages.

I generate a star field by creating a black FBO and drawing white circles on it randomly. Then I get the texture of the FBO, and read that to ofPixels.

The problem is I get these weird patterns like in the image. The kind of remind me of Moiré patterns. I assume it’s an issue with not using an alpha channel somewhere, but I can’t figure out where.

I’m hoping maybe this is a common error and someone will see the image and it’ll remind them of a similar bug.

Thanks in advance!

I didn’t mean for the image to be there; it chopped the end off the ofCubeMap URL. The ofCubeMap git repo is here:

Starfield is meant to look like this btw

that looks like you would be uploading rgba data as rgb or the other way around

Yup, that was it indeed. I was creating my FBO with GL_RGBA, however the calls to glTexImage2D in ofxCubeMap were using GL_RGB.
Thanks for the reply!