From: Yang YuTing (yangyt++at++ihpc.nus.edu.sg)
Date: 06/26/2000 23:14:07
Hi all friends,
Is it possible to map an additional environment to the surface of an object in the CAVE by using Performer and CAVE Performer Lib?
Below is the information about the 4-wall CAVE
2 pfPipe, pipe0 and pipe1;
pipe0 has 1 pfWindow, window00; the size of window00 is 2048*768
pipe1 has 1 pfWindow, window10; the size of window00 is 2048*768
window00 has 4 pfChannels, they are chan000, chan001, chan002 and chan003
orderly;
the viewpot of chan000 is (0,0.5, 0,1)
the viewpot of chan001 is (0,0.5, 0,1)
the viewpot of chan002 is (0.5,1, 0,1)
the viewpot of chan003 is (0.5,1, 0,1)
window01 has 4 pfChannels, they are chan100, chan101, chan102 and chan103
orderly.
the viewpot of chan100 is (0,0.5, 0,1)
the viewpot of chan101 is (0,0.5, 0,1)
the viewpot of chan102 is (0.5,1, 0,1)
the viewpot of chan103 is (0.5,1, 0,1)
These 8 channels corresponds to a wall-eye respectively. All of them are connected to a pfScene, scene0.
I want to do an enviroment texture mapping to the surface of an object, object0, in scene0. The enviroment is another pfScene, scene1. I only want to use the rendered image of the scene1 as the texture of object0. So the scene1 should be not seen anywhere else in CAVE.
My idea to add a new channel to render scene1 in framebuffer, map the framebuffer to the surface of object0 and then overwrite the framebuffer by the rendered image of scene0.
Below is the information after add the new channel
2 pfPipe, pipe0 and pipe1;
pipe0 has 1 pfWindow, window00; the size of window00 is 2048*768
pipe1 has 1 pfWindow, window10; the size of window00 is 2048*768
window00 has 5 pfChannels, they are mychan,
chan000, chan001, chan002 and chan003 orderly;
the viewport of mychan is (0,0.5, 0,1)
the viewpot of chan000 is (0,0.5, 0,1)
the viewpot of chan001 is (0,0.5, 0,1)
the viewpot of chan002 is (0.5,1, 0,1)
the viewpot of chan003 is (0.5,1, 0,1)
window01 has 4 pfChannels, they are chan100, chan101, chan102 and chan103
orderly.
the viewpot of chan100 is (0,0.5, 0,1)
the viewpot of chan101 is (0,0.5, 0,1)
the viewpot of chan102 is (0.5,1, 0,1)
the viewpot of chan103 is (0.5,1, 0,1)
Below are the codes to do environment mapping,
mychan = new pfChannel(pipe0);
mychan->setScene(scene1)
mychan->setTravFunc(PFTRAV_DRAW, DrawMyChan);
void DrawMyChan (pfChannel *channel, void *)
{
channel->clear();
pfDraw();
shared->MyTex->subload(PFTEX_SOURCE_FRAMEBUFFER,
NULL, 0, 0, 768, 0, 0, 1024, 768);
//MyTex is the texture of the object0
}
Because mychan, chan000 and chan001 occupies the same part of the screen(0,1024,0,768), I think the executive of the program for one frame should be as follows:
1)call DrawMyChan. In DrawMyChan, pfDraw draws scene0 and then the framebuffer
is mapped to the surface of object0.
2) call the draw function of other channels, chan000 and chan001 will
overwrite mychan.
But when i run my program, what I see in the surface of object1 is the chan000, but mychan. If I change the order of channels belonging to pipe0 as chan000-> mychan-> chan001->chan002->chan003, then i can see mychan in the surface of object1. But in this case, mychan is not overwrited and can still be seen in the screen.
Anybody know what is wrong with my idea and my code. Thank you very much.
yuting
This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 23:14:22 PDT