예제 #1
0
void display_reset(int samples, bool vsync) {
    int interval = vsync ? 1 : 0;

    if (enigma::is_ext_swapcontrol_supported()) {
        wglSwapIntervalEXT(interval);
    }

    GLint fbo;
    glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo);

    GLuint ColorBufferID, DepthBufferID;

    // Cleanup the multi-sampler fbo if turning off multi-sampling
    if (samples == 0) {
        if (enigma::msaa_fbo != 0) {
            glDeleteFramebuffers(1, &enigma::msaa_fbo);
            enigma::msaa_fbo = 0;
        }
        return;
    }

    //TODO: Change the code below to fix this to size properly to views
    // If we don't already have a multi-sample fbo then create one
    if (enigma::msaa_fbo == 0) {
        glGenFramebuffers(1, &enigma::msaa_fbo);
    }
    glBindFramebuffer(GL_FRAMEBUFFER, enigma::msaa_fbo);
    // Now make a multi-sample color buffer
    glGenRenderbuffers(1, &ColorBufferID);
    glBindRenderbuffer(GL_RENDERBUFFER, ColorBufferID);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, samples, GL_RGBA8, window_get_region_width(), window_get_region_height());
    // We also need a depth buffer
    glGenRenderbuffersEXT(1, &DepthBufferID);
    glBindRenderbufferEXT(GL_RENDERBUFFER, DepthBufferID);
    glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_DEPTH_COMPONENT24, window_get_region_width(), window_get_region_height());
    // Attach the render buffers to the multi-sampler fbo
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ColorBufferID);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthBufferID);
}
예제 #2
0
//NOTE: GM8.1 allowed the mouse to go outside the window, for basically all mouse functions and constants, Studio however
//now wraps the mouse not allowing it to go out of bounds, so it will never report a negative mouse position for constants or functions.
//On top of this, it not only appears that they have wrapped it, but it appears that they in fact stop updating the mouse altogether in Studio
//because moving the mouse outside the window will sometimes freeze at a positive number, so it appears to be a bug in their window manager.
//ENIGMA's behaviour is a modified version of GM8.1, it uses the current view to obtain these positions so that it will work correctly
//for overlapped views while being backwards compatible.
int window_views_mouse_get_x() {
  gs_scalar sx;
  sx = (window_get_width() - window_get_region_width_scaled()) / 2;
  int x = (window_mouse_get_x() - sx) * ((gs_scalar)window_get_region_width() / (gs_scalar)window_get_region_width_scaled());
  if (view_enabled) {
    x = view_xview[view_current]+((x-view_xport[view_current])/(double)view_wport[view_current])*view_wview[view_current];
  }
  return x;
/* This code replicates GM8.1's broken mouse_x/y
  int x = window_mouse_get_x();
  int y = window_mouse_get_y();
  if (view_enabled) {
    for (int i = 0; i < 8; i++) {
      if (view_visible[i]) {
        if (x >= view_xport[i] && x < view_xport[i]+view_wport[i] &&  y >= view_yport[i] && y < view_yport[i]+view_hport[i]) {
          return view_xview[i]+((x-view_xport[i])/(double)view_wport[i])*view_wview[i];
        }
      }
    } 
  }
  return x;
*/
}
예제 #3
0
void display_reset(int samples, bool vsync) {
  set_synchronization(vsync);

  if (!GLEW_EXT_framebuffer_object) return;

  GLint fbo;
  glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &fbo);

  GLuint ColorBufferID, DepthBufferID;

  // Cleanup the multi-sampler fbo if turning off multi-sampling
  if (samples == 0) {
    if (enigma::msaa_fbo != 0) {
      glDeleteFramebuffers(1, &enigma::msaa_fbo);
      enigma::msaa_fbo = 0;
    }
    return;
  }

  //TODO: Change the code below to fix this to size properly to views
  // If we don't already have a multi-sample fbo then create one
  if (enigma::msaa_fbo == 0) {
    glGenFramebuffersEXT(1, &enigma::msaa_fbo);
  }
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, enigma::msaa_fbo);
  // Now make a multi-sample color buffer
  glGenRenderbuffersEXT(1, &ColorBufferID);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorBufferID);
  glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_RGBA8, window_get_region_width(), window_get_region_height());
  // We also need a depth buffer
  glGenRenderbuffersEXT(1, &DepthBufferID);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthBufferID);
  glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_DEPTH_COMPONENT24, window_get_region_width(), window_get_region_height());
  // Attach the render buffers to the multi-sampler fbo
  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorBufferID);
  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, DepthBufferID);
}