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

Thread: how to fade a quad? how to make a cone?

  1. #1
    Member Contributor
    Join Date
    Jun 2005
    Posts
    87

    how to fade a quad? how to make a cone?

    how can i fade a quad? from tranparent to full filled ? my problem is not actually how to fade, thats simple my problem is that i dont know which command to use for fading a quad i tried glcolor4f() but no luck

    thankss

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2002
    Location
    Dresden, Sachsen, Germany
    Posts
    203

    Re: how to fade a quad? how to make a cone?

    On nehe.gamedev.net there is a tutorial on alpha blending I guess that should help you.

  3. #3
    Member Contributor
    Join Date
    Jun 2005
    Posts
    87

    Re: how to fade a quad? how to make a cone?

    but i dont want to blend the quad i just want to change its alpha value

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Ukraine
    Posts
    101

    Re: how to fade a quad? how to make a cone?

    try to enable blending before drawing and set correct blending function. Take a look for functions glBlendFunc() and glEnable/glDisable with parameter GL_BLEND.

  5. #5
    Member Contributor
    Join Date
    Jun 2005
    Posts
    87

    Re: how to fade a quad? how to make a cone?

    BUT I DONT WANT TO BLEND THE QUAD WITH ANY OTHER THING I JUST WANT A SEMI TRANSPARENT QUAD AND GLCOLOR4F(R,G,B,A) ISNT WORKING OKEY I >DONT< WANT TO BLEND ANYTHING!!! I JUST WANT TO CHANGE TRANSPARENCY OF A WHOLE QUAD WHENEVER I WANT THATS ALL IM LOOKING FOR JEEZ

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,662

    Re: how to fade a quad? how to make a cone?

    Make many quads each one with a different color that fades in or out depending on what you want. Insert them in display lists. Then call quickly them in order to achieve the effect

  7. #7
    Senior Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    314

    Re: how to fade a quad? how to make a cone?

    Stop SHOUTING.

    CWiC has already given you your answer.

    Look in the redbook (available under the documentation menu at the main OGL site).

    Chapter 7
    Blending, Antialiasing, and Fog
    Chapter Objectives
    After reading this chapter, you'll be able to do the following:

    Blend colors to achieve such effects as making objects appear translucent
    Blending
    You've already seen alpha values (alpha is the A in RGBA), but they've always been 1.0, and they haven't been discussed. Alpha values are specified with glColor*(), when using glClearColor() to specify a clearing color, and when specifying certain lighting parameters such as a material property or light-source intensity. As you learned in Chapter 5 , the pixels on a monitor screen emit red, green, and blue light, which is controlled by the red, green, and blue color values. So how does an alpha value affect what gets drawn in a window on the screen? When blending is enabled, the alpha value is used to combine the color value of the fragment being processed with that of the pixel already stored in the framebuffer. Blending occurs after your scene has been rasterized and converted to fragments, but just before the final pixels are drawn in the framebuffer. Alpha values can also be used in the alpha test to accept or reject a fragment based on its alpha value. See Chapter 10 for more information about this process.
    Without blending, each new fragment overwrites any existing color values in the framebuffer, as though the fragment is opaque. With blending, you can control how much of the existing color value should be combined with the new fragment's value. Thus, you can use alpha blending to create a translucent fragment, one that lets some of the previously stored color value "show through." Color blending lies at the heart of techniques such as transparency, digital compositing, and
    And if you still think you don't need blending, think about it this way: you are trying to blend a black quad with the background.

    And here's how you enable it:

    Code :
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    That will work whether you use an alpha channel in a texture or just from glColor4f. (Texturing is just a way to specify colors at a more detailed level than vertex level).

  8. #8
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: how to fade a quad? how to make a cone?

    Hey, no need to shout

    >> GLCOLOR4F(R,G,B,A) ISNT WORKING

    glEnable(GL_COLOR_MATERIAL);

    Is it better now ?

  9. #9
    Member Contributor
    Join Date
    Jun 2005
    Posts
    87

    Re: how to fade a quad? how to make a cone?

    Thanks ZbuffeR, but:

    glEnable(GL_COLOR_MATERIAL);

    it disables face culling? I can see my quad from both sides..! I tried to enable it only when working with the quad and later disabling it but it doesnt work all objects are shiny and face culling seems off

  10. #10
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: how to fade a quad? how to make a cone?

    >> it disables face culling?
    No, face culling is something different. Read the docs :
    http://pyopengl.sourceforge.net/docu...terial.3G.html

    And the spec as well :
    http://www.opengl.org/documentation/spec.html

    Why do you need to worry about culling you fading quad by the way ?

    Draw scene
    ortho view
    glEnable(GL_COLOR_MATERIAL);
    draw fade quad
    glDisable(GL_COLOR_MATERIAL);

    Should be ok. Beware that working with stateful graphics can be misleading at times.

Page 1 of 2 12 LastLast

Similar Threads

  1. how to make a hole in quad?
    By mochenoo in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-26-2010, 02:04 AM
  2. Fade in-out a textured quad ?
    By in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 07-31-2005, 07:01 AM
  3. What!?!? Why on Earth won't it make a quad transparent?
    By Andrewinator in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-12-2003, 12:24 PM
  4. How to program fade-in / fade-out effect like movie in OpenGL
    By mdive in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 08-13-2003, 07:01 PM
  5. How can I write a Fade In and Fade Out Effect by OpenGL ?
    By quangkid in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-20-2002, 07:12 PM

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