Hello forum,
I am mixing texture and primitive color. Check the following image:
I want to add color only to the 4 corners of the primitive so that fragment shader can interpolate in between.
Now i am using ofPlanePrimitive object and i found that 100 vertices using the following sniipet:
//--------------------------------------------------------------
void ofApp::setup()
{
if(ofIsGLProgrammableRenderer())
{
shader.load("shader/shader-texture");
}
else
{
std::cout << "Programmable shader is not supported." << std::endl;
}
//load the image
image.loadImage("puppy.jpg");
plane.set(800,600,10,10);
plane.mapTexCoords(0,0,image.getWidth(),image.getHeight());
//add colors to the plane primitive
ofMesh *mesh = plane.getMeshPtr();
//get the size of the vertices inside the plane primitives
unsigned int sizeVertices = mesh->getVertices().size();
for(unsigned int i=0; i < sizeVertices;++i)
{
mesh->addColor(ofFloatColor(ofRandomuf(),
ofRandomuf(),
ofRandomuf()));
}
}
Any hint to get only the 4 corners of the plane primitive instead of the 100 points which i am getting now?