createFrameBuffer textureId renderBufferId = do
  bufferPointer <- malloc :: IO (Ptr GLuint)
  glGenFramebuffers 1 bufferPointer
  bufferId <- peek bufferPointer
  glBindFramebuffer gl_FRAMEBUFFER bufferId

  glFramebufferTexture2D  gl_FRAMEBUFFER gl_COLOR_ATTACHMENT0 gl_TEXTURE_2D textureId 0
  glFramebufferRenderbuffer gl_FRAMEBUFFER gl_DEPTH_ATTACHMENT  gl_RENDERBUFFER renderBufferId

  status <- glCheckFramebufferStatus gl_FRAMEBUFFER
  verifyFrameBuffer status

  glBindFramebuffer gl_FRAMEBUFFER 0
  return bufferId
createFrameBuffer textureId renderBufferId = do
  bufferPointer <- malloc :: IO (Ptr GLuint)
  glGenFramebuffers 1 bufferPointer
  bufferId <- peek bufferPointer
  glBindFramebuffer gl_FRAMEBUFFER bufferId

  glFramebufferTexture2D  gl_FRAMEBUFFER gl_COLOR_ATTACHMENT0 gl_TEXTURE_2D textureId 0
  glFramebufferRenderbuffer gl_FRAMEBUFFER gl_DEPTH_ATTACHMENT  gl_RENDERBUFFER renderBufferId

  status <- glCheckFramebufferStatus gl_FRAMEBUFFER
  verifyFrameBuffer status

  glBindFramebuffer gl_FRAMEBUFFER 0
  return bufferId
createFrameBuffer textureId renderBufferId = do
  bufferPointer <- malloc :: IO (Ptr GLuint)
  glGenFramebuffers 1 bufferPointer
  bufferId <- peek bufferPointer
  glBindFramebuffer gl_FRAMEBUFFER bufferId

  glFramebufferTexture2D  gl_FRAMEBUFFER gl_COLOR_ATTACHMENT0 gl_TEXTURE_2D textureId 0
  glFramebufferRenderbuffer gl_FRAMEBUFFER gl_DEPTH_ATTACHMENT  gl_RENDERBUFFER renderBufferId

  status <- glCheckFramebufferStatus gl_FRAMEBUFFER
  verifyFrameBuffer status

  glBindFramebuffer gl_FRAMEBUFFER 0
  return bufferId