mouseevent - OpenGl selection -


i'm creating box , placing "magnets" on bottom. sides see through(alpha somewhere between .2 , .5) , bottom solid. i'm trying use gluunproject() select "magnet" placed, when sides of box rendered, can't magnets box.

is there anyway still have sides of wall rendered ignore them sake of mouse clicks?

i've tried gl_cull_face @ first glance doesn't seem i'm looking for.

so if understand correctly, have semi-transparent boxes , when magnet inside boxes want see magnet in according semi-transparency of boxes.

my guess when you're drawing boxes have depth writes turned on, way if boxes happen drawn before magnet, when draw magnet fail depth test , part that's inside won't drawn result.

the easiest way is:

  1. draw solid objects first

  2. disable depth writes:

    gldepthmask(gl_false); 
  3. use order-independent blending function when drawing semi-transparent objects, example:

    glblendfunc(gl_one, gl_one) 
  4. draw transparent objects

  5. enable depth writes again

    gldepthmask(gl_true); 

bear in mind simple method work if can away using commutative blending equation, if not consider using order-independent transparency, article "efficient layered fragment buffer techniques" pyarelal knowles, geoff leach, , fabio zambetta


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -