i do not know how to get correct 2D texture coord in GPU from the texture created from 2-d array in CPU.
For example
GLuint edge[3][3][4]=
{
1,0,0,1,
0,1,0,1,
0,0,1,1,
0,0,0,1,
0,0,1,1,
0,0,1,1,
0,0,1,1,
0,0,1,1,
0,0,1,1
};
glGenTextures(1,&tex1);
glBindTexture(GL_TEXTURE_2D,tex1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
//Give it the data
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,3,3,0,GL_RGBA,GL_UNSIGNED_BYTE,edge);
Then i want to access the edge[1][2].rgba,what is the texture coord of edge[1][2].rgba in texture?
How can i use tex2D(sampler,float2(what?,what?)) correctly?