Jump to content
  • Advertisement

Alex Dem

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

121 Neutral

About Alex Dem

  • Rank
    Newbie
  1. Alex Dem

    Blending with two buffers

    Thank you all for the good advice. It will be in good use. However I found what was causing the problem with alpha blend. For the sake of other people that may face the same problem here what it was - I have called  glEnable( GL_COLOR_LOGIC_OP ); glLogicOp( GL_COPY ); which have removed the colors that should have blended. When i removed these two lines - the colors began to blend properly.
  2. Hello. In a previous topic i have asked a question about not working blend in OpenGL. It turns out that even though i have called glEnable(GL_BLEND) and glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) the blending does not change colors in any way despite that i have alpha values for translucent objects. So what is coming to my thought is that the problem should be caused by using two different buffers for rendering . What i am doing is the following: 1. On initializing of OpenGL i set draw buffer to front with glDrawBuffer( GL_FRONT ) 2. Before rendering  objects i set draw buffer to back with glDrawBuffer( GL_BACK ) 3. When drawing objects is complete i swap buffers to show the new scene, meanwhile the buffers have been cleared with GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT. 4. Which comes to the conclusion that blending is performed on an empty or wrong buffer. The question is: How do i perform blending while using front and back buffers, when clearing buffers should be done and which openGl unctions should I use?
  3. Alex Dem

    glBlend not working as expected

    The whole process consist of a loop that loop through my shapes and pass their vertexes to  OpenGl along with a color specified. for(int i = 0; i< m_MyObjects.GetSize(); i++) {   m_MyObjects.GetAt(i).DrawMe(); } DrawMe() function consists of setting color with   glColor4f( color.red, color.green, color.blue, color.alfa ); // where these values are float values and after that i call functions relate to the type of polygons i draw in my scene. If I hard code the alfa value, it stil does not blend the colors in any way. It only draws them under or over another colors lie opaque object.  
  4. Alex Dem

    glBlend not working as expected

    Thanks a lot! And just a final question: Why are not all objects translucent when i set alpha value for each color to be 0.5?
  5. Alex Dem

    glBlend not working as expected

    I have the problem that if i set transparent alphas to all the colors when i draw i still get this picture.  As long as I understood there are two ways in which i can get some (not perfect transparency). I either have to disable z test and z write or i have to sort opaque from transparent objects. Is it mandatory to sort objects in every situation because i think there will be quite slowing when more than 200 objects are transparent and are sorted on each re-rendering?
  6. Hi there. I'm new to OpenGL and I'm having some difficulties with the blending of drawn objects. I have read much resources around the internet but so far nothing helps. I'm just trying to enable simple blend with no sorting of objects. Here is what I'm doing to reach the result of the attached picture : i call : glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glDepthMask( GL_FALSE );   //draw transparent objects   glDepthMask( GL_TRUE); glDisable( GL_BLEND );   On this picture the purple figure have to be blended but it is not. It goes through the silver box, however the color is not blended, but only the color of the box is shown. The alpha factor is 0.1f.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!