Texturing with shader not working [Solved]

So I decided that I wanted to use my new OpenGL book and a nice long 10-day break to learn more updated opengl rendering. It was all going well until I got to doing everything with matrices and texturing with shaders. The matrices are fine, but the shader isn’t showing the texture, but rather a white box.

This is my VertexBufferObject class: http://pastebin.java-gaming.org/f1b90196a1b15

Here is my fragment shader:

#version 150 core

uniform sampler2D texture_diffuse;

in vec4 pass_Color;
in vec2 pass_TextureCoord;

out vec4 out_Color;

void main(void) {
	out_Color = pass_Color;
	// Override out_Color with our texture pixel
	out_Color = texture(texture_diffuse, pass_TextureCoord);
}

Here is my vertex shader:

#version 150 core

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;

in vec4 in_Position;
in vec4 in_Color;
in vec2 in_TextureCoord;

out vec4 pass_Color;
out vec2 pass_TextureCoord;

void main(void) {
	gl_Position = in_Position;
	// Override gl_Position with our new calculated position
	gl_Position = projectionMatrix * viewMatrix * modelMatrix * in_Position;
	
	pass_Color = in_Color;
	pass_TextureCoord = in_TextureCoord;
}

Any help on getting the textures to show up would be appreciated :slight_smile:

Nevermind… I feel quite stupid. In my transfer of the code I forgot to enable GL_TEXTURE_2D.

glEnable(GL_TEXTURE_2D); does nothing when using shaders.

Non-deprecated enums accepted by glEnable(): https://www.opengl.org/sdk/docs/man/html/glEnable.xhtml

Huh. Then I have no clue why the texturing started working :stuck_out_tongue: