Vector of Textures is grayscale not RGB


I am trying to create and store textures at runtime, and also recall previously saved textures from the same vector. The pixels being sent into the texture are allocated with GL_RGB, and the colours do show when they aren’t being set to the array. When they are set to the array, the texture’s glInternalFormat = 2 instead of a long string of numbers

It seems I have two options. Either everything works but it is in grayscale, or there is colour but textures are playing as is (not reading old ones saved in the array).

If anyone has any suggestions it would be much appreciated. I’ve attached some code for reference.

This is the error I’m getting: [ error ] ofGLUtils: ofGetGLFormatFromInternal(): unknown internal format 2, returning GL_RGBA

header file:

vector<ofTexture*> textures;

.cpp file (update):

int r = 255 * ofRandomuf() +10;
int g = 255 * ofRandomuf() +10;
int b = 255 * ofRandomuf() +10;

ofTexture* tex = new ofTexture();
ofPixels pixels;

for (int i = 0; i < 200; i++){
    for (int j =0; j < 200; j++){
        pixels.setColor(i,j,ofColor((int)(ofRandom(r-10, r+10)),(int)(ofRandom(g-10, g+10)),(int)(ofRandom(b-10, b+10))));


.cpp file (draw):


Removing pointers did the trick!