Quote Originally Posted by thokra View Post
Please post both your vertex and fragment shader and you buffer setup code, both for geometry and colors.
My code:
vertex shader:
Code :
in vec3 a_position;
uniform float offset_x;
uniform isamplerBuffer out_offset;
out vec4 offset;
void main()
{ 
      offset=texelFetch(out_offset,int(a_position.z));
	  gl_Position = vec4(a_position.x + offset_x, a_position.y, 1.0, 1.0);
 
}
Fragment shader:
Code :
out vec4 Color;
in vec4 offset;
void main() 
{
 
	 Color = offset;
}

buffer setup code:
Code :
	GLfloat pixels[]={0.0f,1.0f,0.0f,1.0f, 0.0f,0.0f,1.0f,1.0f,  1.0f,1.0f,1.0f,1.0f, 1.0f,0.0f,1.0f,1.0f};
	   GLfloat vertices[] = 
		{
			-0.9f,  -0.6f, 0.0f,
			-0.9f,  -0.9f, 1.0f,
			-0.6f,  -0.9f, 2.0f,
			-0.6f, -0.6f,  3.0f	
 
	 };
				glGenBuffers(1,&bufferid);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glGenBuffers(1,&bufferid)"));
				glBindBuffer(GL_TEXTURE_BUFFER,bufferid);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glBindBuffer(GL_TEXTURE_BUFFER,bufferid);")); 
 
				glBufferData(GL_TEXTURE_BUFFER,sizeof(pixels),pixels,GL_STATIC_DRAW);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glBufferData(GL_TEXTURE_BUFFER,sizeof(vert),vert,*value);"));
 
 
				glGenTextures(1, &buffer_texture);	
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glGenTextures(1, &buffer_texture);")); 
 
 
				glActiveTexture(GL_TEXTURE0);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glActiveTexture(GL_TEXTURE0);")); 
 
				glBindTexture(GL_TEXTURE_BUFFER, buffer_texture);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glBindTexture(GL_TEXTURE_BUFFER, buffer_texture);")); 
 
				glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferid);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferid);")); 
 
 
				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);")); 
 
   				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);")); 
 
 
				attr_vertex = glGetAttribLocation(shader_data.psId, "a_position");
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glGetAttribLocation(shader_data.psId, \"a_position\");"));
				glVertexAttribPointer(attr_vertex, 3 , GL_FLOAT, GL_FALSE ,0, vertices);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glVertexAttribPointer(attr_vertex, 3 , GL_FLOAT, GL_FALSE ,0, 0);"));
				glEnableVertexAttribArray(attr_vertex);
				nResult = GL_ERROR_CHECK((GL_NO_ERROR,"glEnableVertexAttribArray(attr_vertex);"));
 
 
				glDrawArrays(GL_TRIANGLE_FAN,0,4);