C++ – How to translate this code from Processing to C++

c++drawing

I wrote this code in Processing (www.processing.org) and was wondering how would one implement it using C++?

int i = 0;

void setup()
{
size(1000,1000);
}

void draw()
{
//  frameRate(120);
  PImage slice = get();
  set(0,20,slice);  

  if( i % 2 == 0 )  fill(128); else fill(0);
  i++;
  rect(0,0,width,20);
}

As you can see this simply scrolls down rectangles of alternating colors as fast as possible. Can the C++ implementation be as short? OpenGL?

Best Solution

You could also take a look at OpenFrameworks but I doubt that any C++ library will give you such a short implementation.