How to map texture to primitive?

hi ive been struggling with this. ive been reading the opengl programming guide and cant figure out how to map a texture to a primitive. my vertex shader looks like this.

const char *fshader =

	        "#version 430 core                                                              
"

	        "                                                                               
"

	        "uniform sampler2D tex1;                                                           
"

	        "uniform sampler2D tex2;							
"
		
		"in vec2 texcoord;
"
	        
		"                                                                               
"

	        "out vec4 color;                                                                
"

	        "                                                                               
"

	        "void main(void)                                                                
"

	        "{                                                                              
"

	        "    color = texture(tex1, texcoord) + texture(tex2, texcoord);                   
"

	        "}                                                                              
";

no matter what values i give to texcoord the images appear in the top right corner. im using SOIL.

Hello,

you posted a fragment shader (which looks good), but how does your vertex shader look like? What mesh do you want to render? Can you post a screenshot?

[QUOTE=menzel;1254716]Hello,

you posted a fragment shader (which looks good), but how does your vertex shader look like? What mesh do you want to render? Can you post a screenshot?[/QUOTE]

here is my vertex shader

"#version 430 core                                                              
"
	        "layout (location = 0) in vec4 vertices;
"
	        "out vec2 texcoord;
"
	        "                                                                               
"

	        "void main(void)                                                                
"

	        "{                                                                              
"

	        "                                                                               
"

	        "texcoord = vertices.xy;
"
	        "    gl_Position = vertices;                                       
"
	        "}                                                                              
"

and im trying to map it to a square by drawing two triangles

GLfloat vertices[] = {
		-.5, .5, 0, 1,
		-.5, -.5, 0, 1,
		.5, -.5, 0, 1,
		-.5, .5, 0, 1,
		.5, -.5, 0, 1,
		.5, .5, 0, 1
	};

[ATTACH=CONFIG]517[/ATTACH]
this photo actually shows the images in two seperate corners. i can get the image to go to the bottom left corner by:

texture(tex1, gl_FragCoord.xy / textureSize(tex1, 0))

Your texture coordinates go from -0.5 to 0.5, they should go from 0-1.

i still dont get it. I changed my vertex data to

GLfloat vertices[] = {
		
		0, 0, 0, 1,
		0, .25, 0, 1,
		.25, .25, 0, 1,
		.25, 0, 0, 1
	};

and drew a square triangle fan, and it still puts the texture in the top right corner.
does anyone know a good tutorial online for textures using 4.30 compatible code?

also even just the source code for mapping a texture to a specific point on the screen would be very helpful

i just figured it out thanks much for the advice about the texture coordinates menzel.