I just leave here in case its what you need. I don’t think you can ‘draw pixels’ in vertex. You only have one shader per vertex, and when you pass a varying to the next stage it interpotales the value like TextCoord.
In vertex, just pass through with the texture coordinates:
#version 150
uniform mat4 ciModelViewProjection;
in vec4 ciPosition;
in vec2 ciTexCoord0;
out vec2 TexCoord0;
void main(void) {
gl_Position = ciModelViewProjection * ciPosition;
TexCoord0 = ciTexCoord0;
}
In the Fragment you mus pass the dimentions of your texture as a uniform, the lookup texture function range is [0,1] so:
#version 150
out vec4 oColor;
in vec4 inColor;
in vec2 TexCoord0;
uniform vec2 uTextureSize;
uniform sampler2D uTex0; //your texture
void main(void) {
vec2 position = vec2(200,200);//you define
vec2 uv = vec2( position.x / uTextureSize.x , position.y/uTextureSize.y);
//vec4 color = texture( uTex0, TexCoord0);//This is what you would normaly do
vec4 color = texture( uTex0, uv); //retrieves the color at x,y
oColor = color;
}
In the CPU:
mFboWidth = 1920;
mFboHeight = 1080;
mBatch = ci::gl::Batch::create(ci::geom::Plane().size(ci::vec2(mFboWidth, mFboHeight)).axes(ci::vec3(-1, 0, 0), ci::vec3(0, 1, 0)).normal(ci::vec3(0, 0, 1)).origin( ci::vec3( mFboWidth * 0.5, mFboHeight * 0.5, 0) ), mGlsl );
auto lambert = ci::gl::ShaderDef().color();
ci::gl::Fbo::Format format;
format.setSamples( 4 ); // uncomment this to enable 4x antialiasing
mFbo= ci::gl::Fbo::create(mFboWidth, mFboHeight, format.colorTexture());
Render to FBO
ci::gl::ScopedFramebuffer fbScp(mFbo);
// clear out the FBO with blue
ci::gl::clear(ci::Color(0.15, 0.5f, 0.1f));
ci::gl::setMatricesWindow(mFbo->getSize());
// setup the viewport to match the dimensions of the FBO
ci::gl::ScopedViewport scpVp(ci::ivec2(0), mFbo->getSize());
mTexture->bind(mTexture->getId());
int tex = mTexture->getId();
mGlsl->uniform("uTex0", tex);
mGlsl->uniform("uTextureSize", mTexture->getSize());
mBatch->draw();
This has worked for me, may have a typo but let me know.