Results 1 to 10 of 10

Thread: "balls linked togueter" in opengl

  1. #1

    "balls linked togueter" in opengl



    There is something linking the balls together when i switch blend mode to glBlendFunc(GL_SRC_ALPHA, GL_ONE);

    :roll: :?:

    ps: sorry for the strange title
    From brazil (:

    Pascal pownz!

  2. #2

    "balls linked togueter" in opengl

    I never really understood the blend-modes but I guess its the GL_ONE-part.
    Has to be GL_ONE_MINUS_SRC_ALPHA.

  3. #3

    "balls linked togueter" in opengl

    Quote Originally Posted by waran
    I never really understood the blend-modes but I guess its the GL_ONE-part.
    Has to be GL_ONE_MINUS_SRC_ALPHA.
    Same here

    I need "Add" blend mode, whats the opengl code?
    From brazil (:

    Pascal pownz!

  4. #4

    "balls linked togueter" in opengl

    Additive Blending is "glBlendFunc(GL_SRC_COLOR, GL_ONE);".
    No warranty, however

  5. #5

    "balls linked togueter" in opengl

    with glBlendFunc(GL_SRC_COLOR, GL_ONE);


    From brazil (:

    Pascal pownz!

  6. #6

    "balls linked togueter" in opengl

    What kind of picture are you using :?

    It seems to me, that you are using a completely green picture. If that's true, it's quite logical that you get these results. You must make sure that all transparent parts of the picture are black.

    If i were you, i would render a white background, and try to "Add" blend a black picture with a green ball in the middle, over it. If you see black rectangles, something went wrong. If you only see white, and those green balls, Additive blending is working correctly

    Hope this helps.

    P.S. Can you post the picture that you are trying to blend??
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  7. #7

    "balls linked togueter" in opengl

    Quote Originally Posted by chronozphere
    What kind of picture are you using :?

    It seems to me, that you are using a completely green picture. If that's true, it's quite logical that you get these results. You must make sure that all transparent parts of the picture are black.

    If i were you, i would render a white background, and try to "Add" blend a black picture with a green ball in the middle, over it. If you see black rectangles, something went wrong. If you only see white, and those green balls, Additive blending is working correctly

    Hope this helps.

    P.S. Can you post the picture that you are trying to blend??


    The pic is white, and i colorize it with glcolor()

    From brazil (:

    Pascal pownz!

  8. #8

    "balls linked togueter" in opengl

    Huh.. do you use exactly THIS png for rendering?

    I don't know how PNG works, but i think that the whole picture is infact white, but there seems to be alpha data somewhere in the file. I opened it in photoshop, and when i did "Flatten image", the whole thing turned white, and all transparency was gone. I don't know how it works, but i think openGL interprets the data as a totally white picture.

    Anyway... i would advice you to use a black background instead of a transparent one.. If you use photoshop you should add a black layer beneath the current one, and merge them (If im not mistaken.. no real photoshop skilzz here :roll: )

    You could also use TGA. I think OpenGL can handle those quite well. I use it myself in DirectX and i must say that it works great. You can easily add an alpha layer in photoshop, and save it with 32bpp. You don't have to do that when you want to use additive blending, because alpha is not required then.

    Good luck!
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  9. #9

    "balls linked togueter" in opengl

    Thanks chronozphere
    From brazil (:

    Pascal pownz!

  10. #10

    "balls linked togueter" in opengl

    I checked out your png and it is completely the way it should be. To make additive blending you use glBlendFunc(GL_SRC_ALPHA,GL_ONE); which is what you did... Also, the balls "blending" effect is exactly what should happen. Try it with different colors, for example red ball and blue ball overlapped should result in purple color in their intersection. Or 10 very dark green balls result in a light green etc...

    EDIT: Oh! yeah when it comes to additive blending you can indeed get rid of alpha channel. Images on black background in RGB image do good It will also take less video memory.

Bookmarks

Posting Permissions

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