Jump to content

  • Log In with Google      Sign In   
  • Create Account


SDL "Transparent" Window


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Spirrwell   Members   -  Reputation: 263

Like
0Likes
Like

Posted 21 January 2013 - 07:08 AM

Alright, I've got a basic program that renders a rotating sphere of Earth. I've disabled window borders, but I have no idea how I would make the background transparent. The background being the typical black background that you start off with. I'm using SDL 1.2 with OpenGL and I couldn't figure out how to do it either with SDL's functions or OpenGL's.

 

Here's what I see:

 

Screenshotfrom2013-01-21075318_zpsfdd8e7

 

Essentially, how do I make it appear as though the Earth is the only thing showing? Is this possible using the SDL_SetVideoMode() or is it something I have to do through OpenGL?



Sponsor:

#2 PaloDeQueso   Members   -  Reputation: 283

Like
0Likes
Like

Posted 21 January 2013 - 08:18 AM

Have you tried setting the clear buffer color to say, 0, 0, 0, 0?

 

In opengl that is: http://www.opengl.org/sdk/docs/man/xhtml/glClearColor.xml


Edited by PaloDeQueso, 21 January 2013 - 08:18 AM.

Douglas Eugene Reisinger II
Projects/Profile Site

#3 Spirrwell   Members   -  Reputation: 263

Like
0Likes
Like

Posted 21 January 2013 - 08:25 AM

Yep. Doesn't work.


Edited by Spirrwell, 21 January 2013 - 08:26 AM.


#4 Kylotan   Moderators   -  Reputation: 3338

Like
0Likes
Like

Posted 21 January 2013 - 09:09 AM

Are you trying to make the whole window transparent, so that you can see the desktop and other applications beneath? If so, that's unlikely to be something SDL can offer you directly.

 

Most likely you will need to get a handle to the platform specific window object, and change its opacity, using something like Win32's SetLayeredWindowAttributes function. This may only work on windows that were created in a specific way (see the notes at that link) which means you may have to create the window manually and tell SDL to use it via the SDL_WINDOWID 'hack'.



#5 Spirrwell   Members   -  Reputation: 263

Like
0Likes
Like

Posted 21 January 2013 - 09:49 AM

Are you trying to make the whole window transparent, so that you can see the desktop and other applications beneath? If so, that's unlikely to be something SDL can offer you directly.

Yep, but if you look at the picture you may notice I'm using Ubuntu, not Windows. I'm looking for something cross platform, is this possible in SDL 2.0?



#6 Kylotan   Moderators   -  Reputation: 3338

Like
0Likes
Like

Posted 21 January 2013 - 11:45 AM

Aha, sorry for my assumption. No, I don't know anything that is cross-platform compatible.



#7 Spirrwell   Members   -  Reputation: 263

Like
0Likes
Like

Posted 21 January 2013 - 01:06 PM

Aha, sorry for my assumption. No, I don't know anything that is cross-platform compatible.

 

It's okay, I probably would be under Windows, but I can't get the freaking SDL library to build properly with MinGW | MSYS and I got no help at the SDL forums. Say what you want about Linux, it's great for development. But that's off topic, do you know what this concept is called? Maybe I could get a better search if I knew the right term to search.



#8 Kylotan   Moderators   -  Reputation: 3338

Like
0Likes
Like

Posted 01 February 2013 - 07:44 AM

Generally you just want to look for 'opacity' rather than 'transparency' (because technically transparency is the special case of 0% opacity).

 

Under X11, apparently the window managers in use must support the _NET_WM_WINDOW_OPACITY atom. I think you can query for its presence and then set it to a value that reflects the level of opacity you want. Sorry I can't be more help.



#9 adt7   Members   -  Reputation: 425

Like
0Likes
Like

Posted 04 February 2013 - 07:34 AM

Off the main topic, but what problems were you having build SDL(2?) with MINGW?

 

The following should build it fine, replacing the prefix/host variables with the correct ones for your environment.

 

autogen.sh

mkdir build

cd build

./configure --prefix=/path_to_mingw_install/i586-mingw32msvc --host=i586-mingw32msvc

make

make install






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS