Liu Xiaoyan (liuxy++at++ihpc.nus.edu.sg)
Tue, 15 Dec 1998 18:51:55 +0800
Sorry to bring up this topic again, but I do have several problems
regarding this (a little bit long perhaps).What I'm trying to do is real
time texture mapping with textures from pbuffer. Well, the steps I
follow and the respective questions are:
1. define a pfTexture with attributes similar to video texturing
{
pfTexFormat(tex, PFTEX_IMAGE_FORMAT, PFTEX_RGB);
pfTexFormat(tex, PFTEX_EXTERNAL_FORMAT, PFTEX_PACK_16); // 8 or 16?
pfTexFormat(tex, PFTEX_INTERNAL_FORMAT, PFTEX_RGB_5);
pfTexFormat(tex, PFTEX_SUBLOAD_FORMAT, PF_ON);
pfTexImage(tex, NULL, 4, pwidth, pheight, 0); // 4 or 3?
pfTexLoadImage(tex, shared->image); // main memory storing the copy
of pbuffer image
pfTexRepeat(tex, PFTEX_WRAP_S, PFTEX_REPEAT);
pfTexRepeat(tex, PFTEX_WRAP_T, PFTEX_REPEAT);
pfGStateAttr(gst, PFSTATE_TEXTURE, tex);
}
I'm confused by the word "component" in the man pages:
"PFTEX_PACK_8/16 for 8-bit or 16-bit "component" packed bytes..." , does
this component refers the same "component" as in pfTexImage(tex, NULL,
"componet"...)? What do they refer to? My pbuffer attributes are:
{ /* Pbuffer configuration: Single buffered, with depth buffer */
GLX_RENDER_TYPE_SGIX, GLX_RGBA_BIT_SGIX,
GLX_DRAWABLE_TYPE_SGIX, GLX_PIXMAP_BIT_SGIX,
GLX_RED_SIZE, 5,
GLX_GREEN_SIZE, 5,
GLX_BLUE_SIZE, 5,
GLX_DEPTH_SIZE, 1,
GLX_DOUBLEBUFFER, 0,
GLX_STENCIL_SIZE, 0,
None
} so 3 color components are RGB, but the main memory to store the image
is defined as:
GLuint *image= pfMalloc(width * height *sizeof(GLuint), arena), 4 bytes,
thus the component is 4?
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.
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?
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.
5. What's the difference between pfTexture::Load() and Subload()? which
one works for this kind of dynamically changing texture?
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
Thanks for your patience and any help.
Best Regards,
Liu
***********************************************************************
Liu Xiaoyan Institute of High Performance Computing
Research Engineer National University of Singapore
Data Visualisation Group http://www.ihpc.nus.edu.sg Tel:(65)7709267
***********************************************************************
This archive was generated by hypermail 2.0b2 on Tue Dec 15 1998 - 02:54:22 PST