Does SDL really need an X display to work with surfaces?

Does SDL really need an X display to manipulate in-memory surfaces only?

I’m using SDL to do some stuff with images, but I don’t need any
displaying to be done or any kind of interaction with the GUI or user
input. SDL_Init(SDL_INIT_VIDEO) seems to need an X display or else it
fails. Not doing SDL_INIT_VIDEO makes the program crash when trying to
blit surfaces one to another.

Yeah, I want to know about this too.

Can a person init the SDL subsystem and use system
independent software blitters to do things like image
manipulation?

Anyone?

I actually wrote a library for doing stuff like this a while
back, it was a 16 bit graphics processing library called
SparkGL – and it could work with SDL, or be used
standalone and had support for surfaces and such, I should
probably make a 32 bit version.

Paul LoweOn Sunday 10 October 2004 07:38 am, you wrote:

Does SDL really need an X display to manipulate in-memory
surfaces only?

I’m using SDL to do some stuff with images, but I don’t
need any displaying to be done or any kind of interaction
with the GUI or user input. SDL_Init(SDL_INIT_VIDEO)
seems to need an X display or else it fails. Not doing
SDL_INIT_VIDEO makes the program crash when trying to
blit surfaces one to another.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Can’t you just set the SDL_VIDEODRIVER environment var to “dummy” to prevent
SDL from attempting to init the x11 driver?On Sunday 10 October 2004 09:38, Uplink wrote:

Does SDL really need an X display to manipulate in-memory surfaces only?

I’m using SDL to do some stuff with images, but I don’t need any
displaying to be done or any kind of interaction with the GUI or user
input. SDL_Init(SDL_INIT_VIDEO) seems to need an X display or else it
fails. Not doing SDL_INIT_VIDEO makes the program crash when trying to
blit surfaces one to another.


Max Watson <@Max_Watson>

If I remember correctly, you HAVE to use SDL_INIT_VIDEO in the SDL_Init()
function. That’s required. Of course, you aren’t required to set the video
mode to create a window, but I’m sure that you need to initialize the video
in order to avoid a nasty error.

There may be ways around it. I wouldn’t know. As I need to use a display
window with every SDL app I make.

KevinFrom: max@blackholesun.com (Max Watson)
Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: sdl at libsdl.org
Subject: Re: [SDL] Does SDL really need an X display to work with surfaces?
Date: Sun, 10 Oct 2004 18:34:06 -0500

On Sunday 10 October 2004 09:38, Uplink wrote:

Does SDL really need an X display to manipulate in-memory surfaces only?

I’m using SDL to do some stuff with images, but I don’t need any
displaying to be done or any kind of interaction with the GUI or user
input. SDL_Init(SDL_INIT_VIDEO) seems to need an X display or else it
fails. Not doing SDL_INIT_VIDEO makes the program crash when trying to
blit surfaces one to another.

Can’t you just set the SDL_VIDEODRIVER environment var to “dummy” to prevent
SDL from attempting to init the x11 driver?


Max Watson


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Powerful Parental Controls Let your child discover the best the Internet has
to offer.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN? Premium right now and get the
first two months FREE*.

Yeah, I want to know about this too.

Can a person init the SDL subsystem and use system
independent software blitters to do things like image
manipulation?

Anyone?

I think you are looking at a historical artifact. SDL was developed for
use as a game development library so, of course, you want a window,
right? As SDL developed more capabilities were built in that made it a
better and better game development library. But, those features also
make if a great application development platform for all sorts of
graphics. So, now you want to write non-game programs that use the
features of SDL and the game oriented thinking of the original project
is getting in your way.

My guess is that it would be fairly easy to modify SDL to work without
creating a window, or even be on a computer with a video display. Why
not look into the problem and fix it?

While you are at it, try to get SDL to give you keyboard events from an
SDL program running without having created a window.

	Bob PendletonOn Sun, 2004-10-10 at 09:55, Paul Lowe wrote:

I actually wrote a library for doing stuff like this a while
back, it was a 16 bit graphics processing library called
SparkGL – and it could work with SDL, or be used
standalone and had support for surfaces and such, I should
probably make a 32 bit version.

Paul Lowe

On Sunday 10 October 2004 07:38 am, you wrote:

Does SDL really need an X display to manipulate in-memory
surfaces only?

I’m using SDL to do some stuff with images, but I don’t
need any displaying to be done or any kind of interaction
with the GUI or user input. SDL_Init(SDL_INIT_VIDEO)
seems to need an X display or else it fails. Not doing
SDL_INIT_VIDEO makes the program crash when trying to
blit surfaces one to another.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±-------------------------------------+

I ask this question to people a lot - what are you trying to accomplish
with your program? If you state that, people may offer much simpler and
better established solutions for your problem.

For example, I can’t really think of any graphical manipulation that
SDL inherently supports that can’t be done very easily without
including SDL. This would also remove yet another dependency from your
software. Of course it’s quite possible that you have no intention of
distributing your software, in which case, your current path may
actually be slightly (slightly) more convenient for you.

If I remember correctly, you HAVE to use SDL_INIT_VIDEO in the SDL_Init()
function. That’s required. Of course, you aren’t required to set the video
mode to create a window, but I’m sure that you need to initialize the video
in order to avoid a nasty error.

There may be ways around it. I wouldn’t know. As I need to use a display
window with every SDL app I make.

Kevin

The way around it is to use the “dummy” video driver. You can set the
environment variable SDL_VIDEODRIVER to “dummy” either from the shell, or by
using setenv() inside your program before calling SDL_Init(). This is useful
for programs that want to use SDL structures and routines, but note that
without a real video driver, you won’t get any events.

From SDL-1.2.7/src/video/dummy/SDL_nullvideo.c:

/* Dummy SDL video driver implementation; this is just enough to make an

  • SDL-based application THINK it’s got a working video driver, for
  • applications that call SDL_Init(SDL_INIT_VIDEO) when they don’t need it,
  • and also for use as a collection of stubs when porting SDL to a new
  • platform for which you haven’t yet written a valid video driver.On Sunday 10 October 2004 20:13, Kevin Fields wrote:


*/


Max Watson <@Max_Watson>

First of all, when I get a chance, I’ll try the dummy driver. Currently
it works with the X display well enough, even though I don’t initialize
any screen.

Second, the same functions are to be used in both Window-interacting
programs and image processing-only programs that create input images for
the Window apps from other images.

The solution I migrated from was ImageMagick, which was pretty big and
buggy, and PocketFrog, which was used on Windows and PocketPC, to SDL,
which replaces them both, except now we’re talking about Linux and
Windows, and no PocketPC (yet).

I also use SDL to make in-memory surfaces that I send later to a Symbian
phone application for display.

And by PocketPC, I mean Windows CE .NET 3.0 running on some touch screen
tablets (which I may migrate to some sort of embedded Linux when I get
the chance :stuck_out_tongue: )

Donny Viszneki wrote:> I ask this question to people a lot - what are you trying to

accomplish with your program? If you state that, people may offer much
simpler and better established solutions for your problem.

For example, I can’t really think of any graphical manipulation that
SDL inherently supports that can’t be done very easily without
including SDL. This would also remove yet another dependency from your
software. Of course it’s quite possible that you have no intention of
distributing your software, in which case, your current path may
actually be slightly (slightly) more convenient for you.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl