All pastes #738206 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-16 02:40 UTC
rendered paste body
static void
general_blur_exec (const struct pn_actuator_option *opts,
           gpointer data)
{
  GLuint texture_id;

  glGenTextures(1, &texture_id);
  glBindTexture(GL_TEXTURE_2D, texture_id);

  glError();

  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0, GL_RGBA, GL_BYTE, NULL);

  glError();

  // pn_image_data contains the SDL framebuffer dimensions
  glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, pn_image_data->width, pn_image_data->height, 0);

  glError();

  glBindTexture(GL_TEXTURE_2D, 0);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glBlendFunc(GL_SRC_ALPHA, GL_ONE);
  glBindTexture(GL_TEXTURE_2D, texture_id);

  glError();

  glBegin(GL_QUADS);

    glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
    glTexCoord2f(0, 1);
    glVertex2i(-1, -1);
    glVertex2i(-1, 1);
    glVertex2i(1, 1);
    glVertex2i(1, -1);

  glEnd();

  glBindTexture(GL_TEXTURE_2D, 0);

  glError();

  glDeleteTextures(1, &texture_id);

  glFlush();

  glError();
}