Z-buffer problem

New Message Reply Date view Thread view Subject view Author view

Brad Ennis (brenn++at++mcopn1.dseg.ti.com)
Mon, 3 Oct 94 10:39:58 PDT


I am trying to extract z-buffer information using perfly as a prototype to
an application. Thus far the z-output that I get from all pixels is
getgdesc(GD_ZMAX). As per suggestion in the performer info. archives I
inserted the command lsetdepth(0x00, getgdesc(GD_ZMAX) after pfInitGfx.
The code to extract the z-buffer data is in Draw callback function,
post-pfDraw(). The annoying thing I was able to have application work as
a stand alone GL function, but it is not working in the performer environment.
Below is a sample of the code. I am currently running this application on
a Onyx RE2 with 4CPUs, IRIX 5.2. If anyone has any helpful suggestions, I am
willing to try someting new.

#include <Performer/pf.h>
#include <stdlib.h>
#include "math.h"

#define MAX_NOISE 0.0

void drawSARChan( pfChannel* chan )
{

  /* Declare local variables. */
  void *arena;
  static long channel_orgin_x, channel_orgin_y;
  static long sizex, sizey;
  static long pipe_origin_x, pipe_origin_y;
  static short screen_bottom_left_x, screen_bottom_left_y;
  static short screen_top_right_x, screen_top_right_y;
  static float horiz, vert;
  static float near, far;
  static int first_pass = FALSE;
  static unsigned long *inbuff,*outbuff, *zbuff;
             
  /* Get pipe and channel information. */
  pfGetPipeOrigin(pfGetChanPipe(chan), &pipe_origin_x, &pipe_origin_y);
  pfGetChanOrigin(chan, &channel_orgin_x, &channel_orgin_y);
  pfGetChanSize(chan, &sizex, &sizey);
  pfGetChanFOV(chan, &horiz, &vert);
  pfGetChanNearFar(chan, &near, &far);

  /* Set screen positon. */
  screen_bottom_left_x = pipe_origin_x + channel_orgin_x;
  screen_bottom_left_y = pipe_origin_y + channel_orgin_y;
  screen_top_right_x = screen_bottom_left_x + sizex - 1;
  screen_top_right_y = screen_bottom_left_y + sizey - 1;
   
  /* First pass logic, initialization. */
  if (first_pass == FALSE)
  {
    first_pass = TRUE;

    /* Get pointer to shared memory calloc arena created by pfInit()*/
    arena = pfGetSharedArena();

    /*
     * Calloc structures now.
    */
    inbuff = (unsigned long *)pfCalloc(sizex * sizey, sizeof(unsigned long),
arena);
    outbuff= (unsigned long *)pfCalloc(sizex * sizey, sizeof(unsigned long),
arena);
    zbuff = (unsigned long *)pfCalloc(sizex * sizey, sizeof(unsigned long),
arena);

    if (inbuff == NULL || outbuff == NULL || zbuff == NULL)
    {
      fprintf(stderr," inbuff %ld outbuff %ld zbuff %ld\n",
        inbuff, outbuff, zbuff);
      exit(1);
    }
  }

  /* Read the Z-buffer x,y image data into zbuff. */
  zbuffer(TRUE);
  zfunction(ZF_ALWAYS);
  readsource(SRC_ZBUFFER);
  lrectread(screen_bottom_left_x, screen_bottom_left_y,
    screen_top_right_x, screen_top_right_y, zbuff);

Thanks,

Brad


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:50:34 PDT

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