E
E
Evgeny Petryaev2020-03-14 01:06:37
OpenGL
Evgeny Petryaev, 2020-03-14 01:06:37

Why is the frame showing through at the edges?

I don’t understand how to play with the alpha channel, the frame shines through from above and below
5e6c03c47e6a0947130331.png
the code:

void Scene1::ShowRam()
{
  glEnable(GL_ALPHA_TEST);
  glEnable(GL_BLEND);
  glAlphaFunc(GL_GEQUAL, 0.0);
  /*
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE);
  glAlphaFunc(GL_GREATER, 0.0f);
  */
  glBindTexture(GL_TEXTURE_2D, image->IndexTexture[FindTexture(vectorram[0])]);

  glBegin(GL_POLYGON);

  glTexCoord2f(1.0f, 1.0f);
  glVertex3f(1.0f, 1.0f, 0.9f);

  glTexCoord2f(1.f, 0.0f);
  glVertex3f(1.0f, -1.0f, 0.9f);

  glTexCoord2f(0.0f, 0.0f);
  glVertex3f(-1.0f, -1.0f, 0.9f);

  glTexCoord2f(0.0f, 1.0f);
  glVertex3f(-1.0f, 1.0f, 0.9f);

  glEnd();

  glDisable(GL_BLEND);
  glDisable(GL_ALPHA_TEST);
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question