So I’m setting up texture creationg like so, for the data 3 pixels, 1 red, 1 green and 1 blue pixel:
unsigned char* dt = new unsigned char[9];
dt[0] = 255; dt[1] = 0; dt[2] = 0; // red pixel
dt[3] = 0; dt[4] = 255; dt[5] = 0; // green pixel
dt[6] = 0; dt[7] = 0; dt[8] = 255; // blue pixel
glGenTextures(1, &this->id);
glBindTexture(GL_TEXTURE_2D, this->id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 3, 3, 0, GL_RGB, GL_UNSIGNED_BYTE, dt);
glBindTexture(GL_TEXTURE_2D, 0);
Then I’m doing the drawing like:
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, this->tex.id);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex2d(10.0, 10.0);
glTexCoord2f(1.0, 0.0);
glVertex2d(60.0, 10.0);
glTexCoord2f(1.0, 1.0);
glVertex2d(60.0, 60.0);
glTexCoord2f(0.0, 1.0);
glVertex2d(10.0, 60.0);
glEnd();
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
As a result, I don’t get the 3 pixels repeating (like on the rightside of the image), instead I got (on the leftside of the image):
I don’t know where I wen’t wrong, been trying to follow guides as much as possible.