SDL SUPPORT

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

SDL SUPPORT

Post by M4UNOT »

Hello,

Can you use the SDL Library with irrlicht to display images, text etc..?



i also quoted this from the main page of irrlicht: " Added an optional SDL device, to let Irrlicht run on not yet
natively supported platforms like embedded devices. "
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: SDL SUPPORT

Post by hybrid »

Yes, but this only means that device creation (i.e. the underlying main window and user input) is done via SDL. Moreover, there are simple methods to call in Irrlicht to render images and text. So there's no need for other methods from SDL.
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

Re: SDL SUPPORT

Post by M4UNOT »

I know you can dó the same in Irrlicht, but i want to use sdl code/ functions to draw text, images inside Irrlicht ( handle 2d stuff) and use

Irrlicht to do the hardcore 3D stuff

How can you apply text or images from sdl to this lib, can you show me simple code' so i can understand?

In the SDL you can do such:

Code: Select all

// I start by declare the SDL video Name
 
SDL_Surface *screen; 
 
//  set the video mode:
 
screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF | SDL_FULLSCREEN); if (screen == NULL) { printf("Unable to set video mode: %s\n", SDL_GetError()); return 1; }
 
 
// I can now display data, image, text on the screen by using the declared SDL video Name " screen "
 
SDL_BlitSurface(my_image, &src, screen, &dest);
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: SDL SUPPORT

Post by hybrid »

You might be able to get the screen pointer via the exposed video data structure, but I'm not sure
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

Re: SDL SUPPORT

Post by M4UNOT »

Could you please provide mé with code exemple

i don't know how to mix/use irrlicht with SDL / use SDL and integrate to Irrlicht

Code: Select all

 
SDL_init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 0,  SDL_OPENGL | SDL_HWSURFACE );
 
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: SDL SUPPORT

Post by hybrid »

No, no. You have to compile Irrlicht with the SDL device and create the device with EDT_SDL. Then you can ask Irrlicht video driver->getExposedVideoData() for the internal device structures, which, if you are lucky, are the screen value. But you have to look this up in the SDL device source code, because it's not yet documented.
M4UNOT
Posts: 39
Joined: Sat Jun 26, 2010 3:06 pm
Location: Germany

Re: SDL SUPPORT

Post by M4UNOT »

I will try, but can you pass my wish to the dev ?

I hope to see irrlicht with SDL support in next update.

OGRE already work with SDL:
<code>
SDL_init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);

Ogre::Root *root = new Ogre::Root();
root->restoreConfig();
root->initialise(false);

Ogre::NameValuePairList windowSettings;
windowSettings["currentGLContext"] = Ogre::String("True");
Ogre::RenderWindow *window = root->createRenderWindow("MainRenderWindow", 640, 480, false, &windowSettings);
window->setVisible(true); </code>


but i love irrlicht.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: SDL SUPPORT

Post by hybrid »

Man, I am the developer. Maybe first read about whom you'd like to address...
Anyway, SDL support is quite exotic thing. And Irrlicht simply works differently. BTW: I don't think that it's a nice thing to take over a different render context by some strange attribute array setting. Anyway. For Irrlicht you have to recompile IRrlicht with the SDL device, and just create the Irrlicht window as usual. Then the SDL init will be made for you and you can just use the underlying things automatically. You can also pass a window (e.g. created with SDL) to Irrlicht. But you still need the SDL device for this.
Post Reply