Retrive texture from input \ other top \system memory | cpp

Hi there,
I`m trying to receive texture from other top and draw it in the c++ top.
Next and not related i would like to use other texture data, stored in cpu memory and push it every frame to the gpu.

any help or comment will be great.

Shader :

static const char *vertexShader = "#version 330\n\
uniform mat4 uModelView; \
in vec3 P; \
in vec2 UV; \
out vec2 cords; \
void main() { \
cords = UV; \
gl_Position = vec4(P, 1) * uModelView; \
}";

static const char *fragmentShader = "#version 330\n\
uniform sampler2D uTexture ; \
in vec2 cords; \
out vec4 finalColor; \
void main() { \
finalColor = texture(uTexture,cords); \
}";

in the execute function :

[code] glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glUniform1i(myTexSamplerUniform, textureID);

	//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA,    
            GL_UNSIGNED_BYTE, data);
	glBindSampler(textureID, GL_NEAREST);
	glActiveTexture(textureID);

[/code]

setupGL() :

[code] if (myError == nullptr)
{
GLint vertAttribLocation = glGetAttribLocation(myProgram.getName(), “P”);
GLint texAttribLocation = glGetAttribLocation(myProgram.getName(), “UV”);

		std::cout << vertAttribLocation << std::endl;
		std::cout << texAttribLocation << std::endl;
		std::cout << "--------------" << std::endl;


        myModelViewUniform = glGetUniformLocation(myProgram.getName(), "uModelView");
		myTexSamplerUniform = glGetUniformLocation(myProgram.getName(), "uTexture");
		//myColorUniform = glGetUniformLocation(myProgram.getName(), "uColor");
		
		std::cout << myModelViewUniform << std::endl;
		std::cout << myTexSamplerUniform << std::endl;
			
        if (vertAttribLocation == -1 || myModelViewUniform == -1 || texAttribLocation == -1 || myTexSamplerUniform == -1)
        {
            myError = uniformError;
        }

        // Set up our shape
        GLfloat square[] = {
            -1.0, -1.0, 1.0, // position
			0.0,0.0,        //UV
            1.0, -1.0, 1.0,
			1.0,0.0,
            -1.0,  1.0, 1.0,
			0.0,1.0,

            1.0, -1.0, 1.0,
			1.0,0.0,
            1.0,  1.0, 1.0,
			1.0,1.0,
            -1.0,  1.0, 1.0,
			0.0,1.0
        };

        mySquare.setVertices(square, 2 * 15);

		std::cout << vertAttribLocation << std::endl;
		std::cout << texAttribLocation << std::endl;

        mySquare.setup(vertAttribLocation,3,sizeof(float) * 5,0);
		mySquare.setup(texAttribLocation, 2, sizeof(float) * 5, (const void *)12);[/code]

OpenGLTOP.rar (10.6 MB)