# Turning on OpenGL later (SDL bug?)

**URL:** <https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069>\
**Category:** SDL Development\
**Created:** [August 30, 2000, 6:15pm UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069 "2000-08-30T18:15:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Bauer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/c/77aa72/32.png) [@Christian\_Bauer](https://discourse.libsdl.org/u/Christian_Bauer)\
**Post date:** [August 30, 2000, 6:15pm UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069/1 "2000-08-30T18:15:12Z")

</div>

Hi!

The game I’m working on features a set of intro/prefs screens that only  
have 2D graphics for which I’ve already written a set of routines (text,  
polygons, lines etc.). The in-game display can be rendered with OpenGL.

So, I would like to SDL\_SetVideoMode() without SDL\_OPENGL first, and then  
re-set the mode (which may also have a higher resolution) with SDL\_OPENGL  
on when the game starts.

The switch itself seems to work (the 2D window is closed and another  
window opens), but then the game crashes in the event loop in the call to  
SDL\_PollEvent(). The gdb stack trace:

#0 0x4037c92d in XPutImage () from /usr/X11R6/lib/libX11.so.6  
#1 0x4006557a in X11\_RefreshDisplay (this=0x81578b0) at SDL\_x11image.c:391  
#2 0x40063a28 in X11\_DispatchEvent (this=0x81578b0) at SDL\_x11events.c:329  
#3 0x40063b6d in X11\_PumpEvents (this=0x81578b0) at SDL\_x11events.c:384  
#4 0x4006d948 in SDL\_PumpEvents () at SDL\_events.c:350  
#5 0x4006d990 in SDL\_PollEvent (event=0xbffff8b8) at SDL\_events.c:369  
#6 0x80a5ec2 in main\_event\_loop () at shell\_sdl.cpp:437  
#7 0x80a54ac in main (argc=0, argv=0xbffff964) at shell\_sdl.cpp:181  
#8 0x40273a42 in \_\_libc\_start\_main () from /lib/libc.so.6

System information: Debian Linux 2.2 on a 500MHz PIII, XFree 3.3.6 with  
an ATI XPert at work, SDL 1.1.4.

Bye,  
Christian–  
/ Coding on PowerPC and proud of it  
/ [http://www.uni-mainz.de/~bauec002/](http://www.uni-mainz.de/~bauec002/)

---

<div class="post-metadata">

**Author:** ![Mattias\_Engdegard](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/49beb7/32.png) [@Mattias\_Engdegard](https://discourse.libsdl.org/u/Mattias_Engdegard)\
**Post date:** [August 30, 2000, 8:32pm UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069/2 "2000-08-30T20:32:24Z")

</div>

> #0 0x4037c92d in XPutImage () from /usr/X11R6/lib/libX11.so.6  
> #1 0x4006557a in X11\_RefreshDisplay (this=0x81578b0) at SDL\_x11image.c:391  
> #2 0x40063a28 in X11\_DispatchEvent (this=0x81578b0) at SDL\_x11events.c:329  
> #3 0x40063b6d in X11\_PumpEvents (this=0x81578b0) at SDL\_x11events.c:384  
> #4 0x4006d948 in SDL\_PumpEvents () at SDL\_events.c:350  
> #5 0x4006d990 in SDL\_PollEvent (event=0xbffff8b8) at SDL\_events.c:369  
> #6 0x80a5ec2 in main\_event\_loop () at shell\_sdl.cpp:437  
> #7 0x80a54ac in main (argc=0, argv=0xbffff964) at shell\_sdl.cpp:181  
> #8 0x40273a42 in \_\_libc\_start\_main () from /lib/libc.so.6

Why is XPutImage called instead of XShmPutImage? Are you running it on a  
remote X server?

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [August 30, 2000, 9:06pm UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069/3 "2000-08-30T21:06:46Z")

</div>

> The game I’m working on features a set of intro/prefs screens that only  
> have 2D graphics for which I’ve already written a set of routines (text,  
> polygons, lines etc.). The in-game display can be rendered with OpenGL.

> So, I would like to SDL\_SetVideoMode() without SDL\_OPENGL first, and then  
> re-set the mode (which may also have a higher resolution) with SDL\_OPENGL  
> on when the game starts.

> The switch itself seems to work (the 2D window is closed and another  
> window opens), but then the game crashes in the event loop in the call to  
> SDL\_PollEvent(). The gdb stack trace:

Try the latest CVS snapshot. I fixed a bug related to this, but I don’t  
remember if it made it into SDL 1.1.4.

[http://www.libsdl.org/cvs.html](http://www.libsdl.org/cvs.html)

See ya!  
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

---

<div class="post-metadata">

**Author:** ![Daniel\_Vogel](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/d/47e85d/32.png) [@Daniel\_Vogel](https://discourse.libsdl.org/u/Daniel_Vogel)\
**Post date:** [August 30, 2000, 9:05pm UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069/4 "2000-08-30T21:05:29Z")

</div>

The question rather is - why does it call XPutImage at all? Should it do  
this if you specify SDL\_OPENGL???On Wed, Aug 30, 2000 at 10:32:24PM +0200, Mattias Engdeg?rd wrote:

> > #0 0x4037c92d in XPutImage () from /usr/X11R6/lib/libX11.so.6  
> > #1 0x4006557a in X11\_RefreshDisplay (this=0x81578b0) at SDL\_x11image.c:391  
> > #2 0x40063a28 in X11\_DispatchEvent (this=0x81578b0) at SDL\_x11events.c:329  
> > #3 0x40063b6d in X11\_PumpEvents (this=0x81578b0) at SDL\_x11events.c:384  
> > #4 0x4006d948 in SDL\_PumpEvents () at SDL\_events.c:350  
> > #5 0x4006d990 in SDL\_PollEvent (event=0xbffff8b8) at SDL\_events.c:369  
> > #6 0x80a5ec2 in main\_event\_loop () at shell\_sdl.cpp:437  
> > #7 0x80a54ac in main (argc=0, argv=0xbffff964) at shell\_sdl.cpp:181  
> > #8 0x40273a42 in \_\_libc\_start\_main () from /lib/libc.so.6
> 
> Why is XPutImage called instead of XShmPutImage? Are you running it on a  
> remote X server?

–  
Daniel Vogel  
Programmer  
Loki Entertainment Software

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [August 30, 2000, 9:32pm UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069/5 "2000-08-30T21:32:14Z")

</div>

> The question rather is - why does it call XPutImage at all? Should it do  
> this if you specify SDL\_OPENGL???

No, it shouldn’t. That was the bug that was fixed.

See ya,  
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

---

<div class="post-metadata">

**Author:** ![Christian\_Bauer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/c/77aa72/32.png) [@Christian\_Bauer](https://discourse.libsdl.org/u/Christian_Bauer)\
**Post date:** [August 31, 2000, 9:17am UTC](https://discourse.libsdl.org/t/turning-on-opengl-later-sdl-bug/3069/6 "2000-08-31T09:17:22Z")

</div>

Hi!On Wed, 30 Aug 2000, Mattias Engdegard wrote:

> Why is XPutImage called instead of XShmPutImage? Are you running it on a  
> remote X server?

No, locally.

Bye,  
Christian

–  
/ Coding on PowerPC and proud of it  
/ [http://www.uni-mainz.de/~bauec002/](http://www.uni-mainz.de/~bauec002/)
