I've never seen anyone on google searches with this problem so i came here.
I linked, included, and did everything necessary to use SOIL and it's functions.
I load the texture like so in init():
void initRendering() {
std::string vertexInputString="exampleVS.txt";
std::string fragmentInputString="exampleFS.txt";
//create new shader
InitializeProgram(shaderOne, readFiletoString(vertexInputString), readFiletoString(fragmentInputString));
//enables/disables
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glEnable (GL_BLEND);
//glEnable(GL_LIGHTING);
//glEnable(GL_LIGHT0);
//states
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
//load textures
image = SOIL_load_OGL_texture(
"resources/wood.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y
);
if( 0 == image ){printf( "SOIL loading error: '%s'\n", SOIL_last_result());}
//start shader
glUseProgram(shaderOne);
}
For simplicity the wood.png is a 256x256 png texture and loads without an error message.
Here is where i draw the textured quad:
glPushMatrix();
glColor4f(0.0, 0.0, 0.0,1.0f);
glBindTexture(GL_TEXTURE_2D, image);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_DECAL);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_DECAL);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); // when texture area is small, bilinear filter the closest mipmap
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // when texture area is large, bilinear filter the first mipmap
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // texture should tile
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glNormal3f(0.0, 1.0f, 0.0f);
glTexCoord2f(0.0f,0.0f); glVertex3f(-50.0f, 10.0f, 50.0f);
glTexCoord2f(0.0f,1.0f); glVertex3f(-50.0f, 10.0f, -50.0f);
glTexCoord2f(1.0f,1.0f); glVertex3f(50.0f, 10.0f, -50.0f);
glTexCoord2f(1.0f,0.0f); glVertex3f(50.0f, 10.0f, 50.0f);
glEnd();
glPopMatrix();
The result is simply an all black texture instead of a wood texture: