title: SDL2 AntiAliasing
body: <p>How to turn on antialiasing in SDL2, when using SDL_RenderCopyEx?</p>
  
  <p>I find some articles that suggest to use:</p>
  
  <pre><code>SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
  SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>glEnable(GL_MULTISAMPLE);
  </code></pre>
  
  <p>But this makes no effect. Any ideas?</p>
  
  <pre><code>int Buffers, Samples;
  SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &amp;Buffers );
  SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &amp;Samples );
  cout &lt;&lt; "buf = " &lt;&lt; Buffers &lt;&lt; ", samples = " &lt;&lt; Samples;
  </code></pre>
  
  <p>returns</p>
  
  <p>buf = -858993460, samples = -858993460.</p>
  
  <p>EDIT: CODE:</p>
  
  <pre><code>   #include &lt;windows.h&gt;
  #include &lt;iostream&gt;
  
  #include &lt;SDL2/include/SDL.h&gt;
  #include &lt;SDL2/include/SDL_image.h&gt;
  
  using namespace std;
  
  
  int main( int argc, char * args[] )
  {
      // Inicjacja SDL'a
      SDL_Init(SDL_INIT_EVERYTHING);
  
      SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
      SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8);
  
      SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); 
  
      // Tworzenie okna
      SDL_Window *win = nullptr;
      win = SDL_CreateWindow("abc", 100, 100, 800, 600, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
  
      if (win == nullptr) 
      {
          std::cout &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
          system("pause");
          return 1;
      }
  
  
      int Buffers, Samples;
      SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &amp;Buffers );
      SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &amp;Samples );
      cout &lt;&lt; "buf = " &lt;&lt; Buffers &lt;&lt; ", samples = " &lt;&lt; Samples &lt;&lt; ".";
  
      // Create Renderer
      SDL_Renderer *ren = nullptr;
      ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
  
      if (ren == nullptr)
      {
          std::cout &lt;&lt; SDL_GetError() &lt;&lt; std::endl;
          return 1;
      }
  
      // Create texture
      SDL_Texture *tex = nullptr;
      tex = IMG_LoadTexture(ren, "circle.png");
  
      SDL_SetTextureAlphaMod(tex, 100);
  
      SDL_Rect s,d;
      SDL_Point c;
      s.x = s.y = 0;
      s.w = s.h = 110;
  
      d.x = 320;
      d.y = 240;
      d.w = d.h = 110;
  
      c.x = c.y = 55;
  
      // Event Queue
      SDL_Event e;
      bool quit = false;
      int angle = 0;
  
      while(!quit)
      {
          while (SDL_PollEvent(&amp;e)){
              //If user closes he window
              if (e.type == SDL_KEYDOWN)
                  quit = true;
          }
          angle += 2;
  
          float a = (angle/255.0)/M_PI*180.0;
  
          // Render
          SDL_RenderClear(ren);
          SDL_RenderCopyEx(ren, tex, &amp;s, &amp;d, a, &amp;c, SDL_FLIP_NONE);
          SDL_RenderPresent(ren);
  
  
      }
  
      // Release
      SDL_DestroyTexture(tex);
      SDL_DestroyRenderer(ren);
      SDL_DestroyWindow(win);
  
      // Quit
      SDL_Quit();
  
      return 0;
  }
  </code></pre>
  
  <p>Do not worry about style or errors related to memory deallocation, etc. It was a quick sketch to test the possibility SDL'a</p>