示例#1
0
void Window::Show()
{
  while (!glfwWindowShouldClose(handle))
  {
    glUseProgram(text_renderer->program);

    // get viewport size
    glfwGetFramebufferSize(handle, &width, &height);

    // set the viewport
    glViewport(0, 0, width, height);

    glClearColor(0,0,0,0);
    glClear(GL_COLOR_BUFFER_BIT);

    // enable blending
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    GLfloat black[4] = { 1,1,1,1 };

    // set font size and color
    FT_Set_Pixel_Sizes(text_renderer->normal_face, 0, 18);
    glUniform4fv(text_renderer->uniform_color, 1, black);

    // coordinates range from -1 to 1 in either direction
    
    DrawEverything();

    glfwSwapBuffers(handle);

    glfwPollEvents();
  }
}
示例#2
0
文件: draw.c 项目: bgamari/geda-pcb
void
hid_expose_callback (HID * hid, BoxType * region, void *item)
{
  HID *old_gui = gui;

  gui = hid;
  Output.fgGC = gui->graphics->make_gc ();
  Output.bgGC = gui->graphics->make_gc ();
  Output.pmGC = gui->graphics->make_gc ();

  hid->graphics->set_color (Output.pmGC, "erase");
  hid->graphics->set_color (Output.bgGC, "drill");

  if (item)
    {
      doing_pinout = true;
      draw_element ((ElementType *)item);
      doing_pinout = false;
    }
  else
    DrawEverything (region);

  gui->graphics->destroy_gc (Output.fgGC);
  gui->graphics->destroy_gc (Output.bgGC);
  gui->graphics->destroy_gc (Output.pmGC);
  gui = old_gui;
}