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 2 of 2

Thread: graphics query

  1. #1
    Intern Contributor
    Join Date
    Aug 2003
    Location
    singapore
    Posts
    87

    graphics query

    i drew several rectangles on top of one another on screen. Now I want to use the top most rect and make a certain part of it transparent. How do I focus on the topmost rect and do the transparency?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: graphics query

    Hi !

    OpenGL is a state machine, you before you render anything you change the state of opengl to want you want (color, transparency, transformation, fog and so on), render your rectangle and then restore or modify the state and render the next thing.

    Transparency is activated with glEnable( GL_BLEND), this wil "blend" the color of your rectangle with whatever is in the background (the 4th color value, the alpha value is used to set the transparency of the color), but please notice that there are a few other things to take care of to make your objects transparent, the NeHe tutorials has examples and google is full of them.

    And finally, opengl uses a pipeline to do the rendering, you give opengl everything to render, when opengl is done with it it throws it away, so if you need to "modify" something you have to modify the object yourself and render it again, opengl does not have any information about your objects, it just keeps the triangles in memory long enough to render the result, then it is no longer needed.

    Mikael


    [This message has been edited by mikael_aronsson (edited 12-15-2003).]

Posting Permissions

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