OpenGL in draw callback

New Message Reply Date view Thread view Subject view Author view

Jeannie Burleson (jeannie++at++cambertx.com)
Fri, 14 Jun 96 08:46:17 PDT


Hello,

  I am very new to OpenGL -- but I think that my question
is a pretty *basic* one. I am trying to do some pixel
manipulation (OpenGL) in my draw callback function (using
perfly).

  Since, I've been having problems all I would like to
do is read in the frame buffer & write it back out again.
No changes, nothing. The code I've added in my callback
is:

  ...
  PreDraw() ;
   
  // my predraw stuff

  glReadPixels ( 0, 0, x_window_size, y_window_size,
                 GL_RGBA, GL_BYTE, buffer ) ;

  // this is where I'll add in my manipulation stuff

  glRasterPos2i ( 0, 0 ) ;
  glDrawPixels ( 0, 0, x_window_size, y_window_size,
                 GL_RGBA, GL_BYTE, buffer ) ;

  pfDraw() ;
  PostDraw() ;

Definitions:
  struct PixelType
  {
    unsigned char r, g, b, a ;
  } ;
  int x_window_size = 1280 ;
  int y_window_size = 1024 ;
  PixelType *buffer = new PixelType [ x_window_size * y_window_size ] ;

  I would have thought that these lines of code would do
essentially nothing. BUT, I end up with 2 images on the screen.
The first starts at the lower left hand corner, and the second
image starts to the right & above the middle point in the screen.
Most (3/4) of the second image isn't displayed since it falls
off the screen. I thought that the glRasterPos2i would force
the new image (glDrawPixels) to be drawn starting at the lower
left hand of the frame buffer.

  I figure I must be using these routines incorrectly, but I
can't figure it out from the man pages. I would appreciate any
help!! Thanks in advance.

                             Jeannie

********************************************************
Jeannie M. Burleson email: jeannie++at++cambertx.com
Camber Corporation voice: (214) 991-5322 x160
4885 Alpha Rd. Suite 110 fax: (214) 991-5352
Dallas, TX 75244
********************************************************

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:00 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.