Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Creating invisible object

  1. #1
    Newbie Newbie
    Join Date
    Sep 2012
    Posts
    2

    Question Creating invisible object

    Hi,

    I would like to create a totally "invisible" object (can be a simple one, like a "gluCylinder"). The viewer would notice the object when it is behind or collide with another object - example, if a "glutSolidCube" is behind my "invisible gluCylinder", the cube would be partially occluded by the cylinder (we would see the background on the occluded area).

    How can I do that? I've tried to use glColorMask, so I could hide the cylinder , but the mask affected the whole frame instead of only the cylinder (maybe I'm not using it correctly, is there a way of doing it only for one (or a few) objects?). I don't think transparency would work for me, because I'd see the occluded part of the cube, for instance.

    Can you help?

    Thanks in advance

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    Quote Originally Posted by leoalvesmachado View Post
    I've tried to use glColorMask, so I could hide the cylinder , but the mask affected the whole frame instead of only the cylinder
    Well, because you didn't reset the color mask after you've drawn the invisible cylinder. Set glColorMask to all false before drawing the invisible cylinder then reset it to all true.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Newbie Newbie
    Join Date
    Sep 2012
    Posts
    2
    Quote Originally Posted by aqnuep View Post
    Well, because you didn't reset the color mask after you've drawn the invisible cylinder. Set glColorMask to all false before drawing the invisible cylinder then reset it to all true.
    Thanks, it worked.
    I was putting false only on the color I was drawing the object and reseting it. I should have put everything false as you suggested.

Posting Permissions

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