Results 1 to 2 of 2

Thread: alpha blending problem

  1. #1
    Junior Member
    Join Date
    Jul 2006

    alpha blending problem

    I have a problem with alpha blending.
    I disable depth test and draw a solid cube and a solid sphere, cube is semi transparent, the sphere is opaque.
    When the sphere is in front of the cube is semi transparent too. Why?
    The blend function is SRC_ALPHA, ONE_MINUS_SRC_ALPHA .
    Thank a lot

  2. #2
    Junior Member
    Join Date
    Oct 2006
    I assume you mean that from the point of view of the camera, the sphere is in front of the cube. That the sphere should occlude all or part of the cube from view.
    But what you are seeing is cube drawn in front of the sphere.

    The fact that you turned depth test off seems wrong to me.

    A better way to draw is as follows:
    - draw all the opaque stuff(Depth Writes on, Blending off)
    - draw all the transparent stuff in back to front order(Depth Writes off, Blending on)

    Depth Test should be on.

Similar Threads

  1. Replies: 3
    Last Post: 06-16-2011, 11:51 AM
  2. Source Alpha Blending without an Alpha Buffer
    By niallm in forum OpenGL ES
    Replies: 1
    Last Post: 06-18-2009, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean