Hi Stefan,

I can now display one of my textures with Equalizer, using the basic
config.eqc . However, something is still wrong: the screen is out of
control :-) (I don't believe my data is going to the back buffer as
I wish it to). So here is my question:

In my code, I have a framebuffer with two attached buffers, used in
ping-pong fashion. I display 9 times into this buffer, then display
the image to the back screen using glDrawBuffer(GL_BACK). That was standalone.

I send you some code to give you an idea. I call run() from within
franeDraw(). Should this work? You'll note that there is no swap buffer
method call in my code.

   Best,

   Gordon


------------------

void DistanceTransform::run()
{
     stepLength = tex_size / 2;

     for (int i=0; i < 9; i++) {
         if (stepLength < 1) stepLength = 1;
         updateTexture();
         stepLength /= 2;
     }

     pp->toBackBuffer();
}

-----------------------------------


----------------------------
void PingPong::toBackBuffer()
{
     drawFBOtoScreen_b(GL_BACK, getTexture());
}

void PingPong::drawFBOtoScreen_b(GLenum screen, TexOGL& texture)
// unfortunately, the image on the screen appears to be 8 bit.
// simply draw the texture to the screen. The second argument is not  
necessary.
{
     // Perhaps I should remember the active shader and reactivate it  
at the end?
     // This method is called because most people will forget it.
     glUseProgram(0);

     if (screen != GL_FRONT && screen != GL_BACK) {
         printf("drawFBOtoScreen: screen should be GL_FRONT or GL_BACK\n");
         exit(0);
         //return;
     }

     FramebufferObject::Disable(); // must be done BEFORE glDrawBuffer()
     glDrawBuffer(screen); // front or back

     int tg = texture.getTarget() == GL_TEXTURE_2D ? 0 : 1;

     texture.bind();
     glEnable(GL_TEXTURE_2D);

     glMatrixMode(GL_PROJECTION);
     glPushMatrix();
     glLoadIdentity();
     gluOrtho2D(0., 1., 0., 1.);
     glMatrixMode(GL_MODELVIEW);
     glPushMatrix();
     glLoadIdentity();

     int sz = texture.getTarget() == GL_TEXTURE_2D ? 1.0 : texture.getHeight();

     // should not clear the screen here. It should be cleared at the  
beginning of the
     // main display function
     //glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

     glBegin(GL_QUADS);
       glTexCoord2f(0., 0.);
       glVertex2f(0., 0.);

       glTexCoord2f(sz, 0.);
       glVertex2f(1., 0.);

       glTexCoord2f(sz, sz);
       glVertex2f(1., 1.);

       glTexCoord2f(0, sz);
       glVertex2f(0., 1.);
     glEnd();

     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
     glMatrixMode(GL_MODELVIEW);
     glPopMatrix();

     glDisable(texture.getTarget());
}




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


_______________________________________________
eq-dev mailing list
[email protected]
https://in-zueri.ch/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Reply via email to