Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Please, I need some help!!!!

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    11

    Please, I need some help!!!!

    Hi,

    Well, I need to do the following steps:

    1º I will load a 3D Object and rotate it three times in different directions, then I'll save the buffers A, B and C ( A= Rotation 1, B= Rotation 2 and C= Rotation 3).... at buffer "A" I'll only let the RED Channel active (i.e. if the pixel "x" is 101,011,111 - it'll change to 101,000,000 ), at buffer "B" only GREEN channel.. and so on;

    2º Now, I need to do an OR operation between the RGB Channels from the buffers ( A,B and C) for each pixel and save the result:

    Pixel X in Buffer A: R -> (101,000,000)
    Pixel X in Buffer B: G -> (000,110,000)
    Pixel X in Buffer C: B -> (000,000,010)
    ----------------------------
    Pixel X in Buffer R: RGB -> (101,110,010)

    3º Show at screen

    Well, the result is a Stereogram of the original 3D Object

    =>Is there any other function besides glReadPixels() that will help me doing this?

    [This message has been edited by ArkAnjo (edited 12-05-2002).]

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    767

    Re: Please, I need some help!!!!

    glColorMask()

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: Please, I need some help!!!!

    You need to stop thinking at the pixels level. You can't access the frame buffer directly, and if you do it indirectly with glReadPixels, chances are it will be extremely slow (unless you only do it for a small window) due to the video memory read back.

    You can use the color mask; an alternative would be to use a pure red light in a first pass, render A; clear ZBuffer; then do again with a green light and B; clear and finally with a blue light and C.

    Y.

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    11

    Re: Please, I need some help!!!!

    [This message has been edited by ArkAnjo (edited 12-06-2002).]

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    11

    Re: Please, I need some help!!!!

    Originally posted by Ysaneya:
    "chances are it will be extremely slow"
    Ysaneya: I know that if I do this operantion between pixels it 'll be really slow ( O n²) but at this moment it isn't important in my work. I'll try the way you suggest too (Color Mask), Tks for your attention.

    PS.: I've already think in this alternative that you suggest -> "using a pure red light in a first pass, render A; clear ZBuffer; then do again with a green light and B; clear and finally with a blue light and C"... but if I do this, it'll be a fake stereogram , because in any moment I did the operation between the channels color, the result is 3 frames rendering extremely fast that give the impression of a stereogram.


    [This message has been edited by ArkAnjo (edited 12-06-2002).]

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    11

    Re: Please, I need some help!!!!

    Originally posted by rgpc:
    glColorMask()
    Tks for your help.

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: Please, I need some help!!!!

    but if I do this, it'll be a fake stereogram , because in any moment I did the operation between the channels color, the result is 3 frames rendering extremely fast that give the impression of a stereogram.
    I'm not sure to understand you well here Do you mean you're not using double-buffering, and you can see in "live" the objects being painted on screen ?

    Y.

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: Please, I need some help!!!!

    *ahem*
    Code :
    glColorMask(true,true,true,true); //make sure we clear all colors
    glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
    glColorMask(true,false,false,true);
    render_thingy();    //will only go to red channel
    glClear(GL_DEPTH_BUFFER_BIT);
    jitter_a_bit();
    glColorMask(false,true,false,true);
    render_thingy();    //will only go to green channel
    glClear(GL_DEPTH_BUFFER_BIT);
    jitter_a_bit_more();
    glColorMask(false,false,true,true);
    render_thingy();    //will only go to blue channel
    SwapBuffers(blabla);
    Rinse, wash, repeat.

  9. #9
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    11

    Re: Please, I need some help!!!!

    Originally posted by Ysaneya:
    I'm not sure to understand you well here Do you mean you're not using double-buffering, and you can see in "live" the objects being painted on screen ?

    Y.

    I'll try to explain.. err let see...

    When you told to me:

    "using a pure red light in a first pass, render A; clear ZBuffer; then do again with a green light and B; clear and finally with a blue light and C"...

    Did you mean that every time that I clear the ZBuffer I'll show it before clear, then do again with green light... show and clear.... and finally with a blue light.. show and clear... or am I wrong?


    if I'm right, then.... this process didn't create a true stereogram, because it'll be showing the object in Red .. then Green and Blue ( 3 frames )... and i need all these frames in one

    Well, if I'm wrong... heheh I didn't understand what did you try to explain to me before...

    PS.: I need to use a Double Buffering... or I 'll never find a way to create my stereogram ...

  10. #10
    Junior Member Newbie
    Join Date
    Dec 2002
    Posts
    11

    Re: Please, I need some help!!!!

    Originally posted by zeckensack:
    *ahem*
    Code :
    glColorMask(true,true,true,true); //make sure we clear all colors
    glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
    glColorMask(true,false,false,true);
    render_thingy();    //will only go to red channel
    glClear(GL_DEPTH_BUFFER_BIT);
    jitter_a_bit();
    glColorMask(false,true,false,true);
    render_thingy();    //will only go to green channel
    glClear(GL_DEPTH_BUFFER_BIT);
    jitter_a_bit_more();
    glColorMask(false,false,true,true);
    render_thingy();    //will only go to blue channel
    SwapBuffers(blabla);
    Rinse, wash, repeat.
    Tks man.. I'll try it..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •