3
\$\begingroup\$

I've been trying to have text rendering in my OpenGL scene using SDL2. The tutorial I came across is this one Rendering text

I followed the same code, and I get text rendering fine. However the issue I'm having is that there is obviously a "conflict" between the OpenGL rendering and the SDL_Renderer used in the code. When I run my scene the text displays but everything else keeps flickering. The following gif shows the issue:

enter image description here

Any idea on how to overcome this while still just using SDL2 and OpenGL, not another library or anything.

Thanks

\$\endgroup\$
3
  • \$\begingroup\$ I wonder if there is a solution that doesn't include creating an OpenGL texture and moving the SDL2_ttf created SDL_Surface into it. \$\endgroup\$
    – akaltar
    Mar 5, 2015 at 14:58
  • 1
    \$\begingroup\$ If you cut/pasted from two different tutorials, make sure you're not calling both SDL_RenderPresent() and wglSwapBuffers(). \$\endgroup\$
    – John K
    Mar 16, 2015 at 1:59
  • \$\begingroup\$ Minimal SDL + OpenGL example at: stackoverflow.com/questions/40061276/… then add the text specifics from: stackoverflow.com/questions/8847899/… \$\endgroup\$ Nov 22, 2017 at 22:30

1 Answer 1

0
\$\begingroup\$

There is a problem using SDL_Renderer with OpenGL. You can save the text to a Surface, and then use this example: http://www.sdltutorials.com/sdl-tip-sdl-surface-to-opengl-texture

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .