Phil Keslin (philk++at++cthulhu.engr.sgi.com)
Tue, 15 Dec 1998 10:53:02 -0800
The attributes that you have defined describe a 16bit texel or pixel
with 5 bits allocated to each of the red, green and blue components and
a single bit to the alpha component. The component parameter defines the
number of components. In this case, that is 4 (red, green, blue, and
alpha). The storage required to hold these pixels is
width*height*sizeof(short). You will overallocate in your example.
BTW, don't use PIXMAP to define a pbuffer. The correct drawable type is
GLX_PBUFFER_BIT_SGIX.
>
> 2. to get pbuffer rendering work, loading image into main memory using
> glReadPixles in the DRAW process as below:
> void updateImage(void)
> {
> dsp = pfGetCurWSConnection();
> read = pfGetPWinWSDrawable(shared->pwPbuf);
> ctx = pfGetPWinGLCxt(shared->pwPbuf);
> glXMakeCurrent(dsp, read, ctx);
> glPixelStorei(GL_PACK_ALIGNMENT, 2); // 1 or 2 ?
> glReadPixels(0, 0, pwidth, pheight, GL_RGB, GL_UNSIGNED_INT,
> shared->image);
> }
> what alignment and packing should I use in order to be consistent with
> the settings above for pfTexture? I only got garbage image.
When you read your pixels, you should only read the pixels in the
required type. You are using 6x the bandwidth requirement for reading
from the pipe by requesting and UNSIGNED_INT from the pipe.
Additionally, you are overflowing you data region. Each component read
from the pipe is an unsigned int making for a 12 byte pixel.
The following should work (assuming the contents of the pbuffer are
valid).
glPixelStorei(GL_PACK_ALIGNMENT, 2);
glReadPixels(0, 0, pwidth, pheight, GL_RGB,
GL_UNSIGNED_SHORT_5_5_5_1_EXT,
share->image);
It is also possible to copy the contents of the pbuffer directly to the
texture.
glCopyTexSubImage2DEXT(GL_TEXTURE_2D, 0, 0, 0, 0, 0, pwidth, pheight);
This assumes that the texture is bound and the context for the pbuffer
is current and the ReadBuffer is set correctly.
> 3. Also in the DRAW process, call pfLoadTex to page in new buffer
> images:
> { pfLoadTex(tex);
> pfApplyTex(tex);
> pfClearChan(chan);
> pfDraw();
> }
> But I cannot see the new buffer being texture mapped onto the geometry.
> What's going wrong in these steps?
Your readback format doesn't match your texture format.
> 4. Since I'm paging texture from a pbuffer, I tried:
> pfTexLoadMode(tex, PFTEX_LOAD_SOURCE, PFTEX_SOURCE_FRAMEBUFFER);
> the program hangs for a few seconds and I get logged out! Why there are
> no options to specify which framebuffer to be used as Source? Is it
> possible to set a pbuffer as source for texture subloading? If yes, I
> can jump over copying from pbuffer to main memory.
make current to the pbuffer
bind the texture
copytexsubimage2dext to the texture
I can't recall the Performer nomenclature for these, but someone else
might.
> 5. What's the difference between pfTexture::Load() and Subload()? which
> one works for this kind of dynamically changing texture?
Subload.
> 6.I also got this message, what does it tell me?
>
> PF Warning/Usage: pfGetVClock() not supported for this
> context.
> PF Fatal/Internal: Assertion failed: gotNewFrame ==
> (currentCullDrawBuffer!=prevCullDrawBuffer || frameCount == 0) in
> ../../../lib/libpf/pfProcess.C at line 6700
Don't know. Someone else might though.
- Phil
-- Phil Keslin <philk++at++engr.sgi.com>
This archive was generated by hypermail 2.0b2 on Tue Dec 15 1998 - 10:53:06 PST