Todd A. Kennard | 1 Mar 2007 01:01
Picon
Favicon

Re: SDL displaying wrong colors with DirectX and windowed 8bpp mode

From: Japheth <mail <at> japheth.de>
Date: February 28, 2007 6:00:56 AM GMT-05:00
To: "A list for developers using the SDL library. (includes SDL-announce)" <sdl <at> lists.libsdl.org>
Subject: Re: [SDL] SDL displaying wrong colors with DirectX and windowed 8bpp mode
Reply-To: "A list for developers using the SDL library. \(includes SDL-announce\)" <sdl <at> lists.libsdl.org>



But I possibly can try to add a SDL_SetColors/SDL_SetPalette call after SDL_SetVideoMode, setting the very same palette as it is done with SDL_VIDEODRIVER=windib.


This didn't help. I looked in the SDL source and realized that the code for directx carefully avoids touching palette entries 0-9 and 246-255 in window mode. So these 20 entries will always have the standard values. I'm sure there are good reasons doing so, but OTOH it would be good if directx and windib don't behave differently in this regard.


Those pallet entries mentioned are reserved for the Windows operating system default system colors. I've used them for my own purposes but always made sure to restore them when the application finished. You can do anything you want with software; it's just how much flak can you handle when your code misbehaves ? ;p

Todd




_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
呂 瑞鴻 | 1 Mar 2007 03:43
Picon
Favicon

Re: sdl only support fullscreen on embedded platform?


>From: "Ryan C. Gordon" <icculus <at> icculus.org>
>Reply-To: "A list for developers using the SDL library. (includes  
SDL-announce)" <sdl <at> lists.libsdl.org>
>To: "A list for developers using the SDL library. (includes SDL-announce)" 
<sdl <at> lists.libsdl.org>
>Subject: Re: [SDL] sdl only support fullscreen on embedded platform?
>Date: Wed, 28 Feb 2007 15:32:50 -0500
>
>
> > I cross compile this application and run it on a 640x480 LCD. It works
> > well with fullscreen scale. Then I wanted to test the non-fullscreen
> > mode to see if sdl application can work well with framebuffer. A
> > change was made to the video set section like:
> > (screen=SDL_SetVideoMode(320,240,video_bpp,videoflags)
> > The screen turns black as long as the changed application runs on 
board.
>
>I assume this is Linux, using the fbcon driver.
>
>Always use fullscreen on an embedded device that doesn't have a window
>manager...if you set a 320x240 fullscreen mode on hardware that only
>does 640x480, SDL will make a 320x240 window in the center of the
>640x480 display, and put a black border around it.
>
>Arguably, the fbcon target should just return NULL from
>SDL_SetVideoMode() if you don't request SDL_FULLSCREEN or just force it
>to fullscreen. I'll have to check that.

I have the same problem.
If I use SDL to play video, SDL will put a black border around the LCD.
Then I can not control the display of video.
Have any method to solve the problem?
Thanks in advance and apologize to my poor english.

_________________________________________________________________
超大 2GB 信箱容量 Windows Live Mail 搶鮮版:全新界面使用更方便 
http://ideas.live.com/programpage.aspx?versionid=5d21c51a-b161-4314-9b0e-4911fb2b2e6d 

_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Andre de Leiradella | 1 Mar 2007 04:06
Picon

Re: Flickering and division by zero in Windows

Hi Ryan.
> I'm just wondering if SDL_gfx is implicitly calling SDL_Flip() and so 
> are you, causing you to each update a different buffer with some part of 
> the rendering (and hence, flicker).
>   
Now I understand. I had a look at SDL_gfxPrimitives' source code and 
there is no SDL_Flip in there though.
> I'm just guessing, though. Can you post source code that triggers this 
> issue? That would make it much easier to say what's going wrong.
>   
Lua code? Won't help much... but here it goes:

-- set the video mode
local screen = image_lib.set_video(800, 600)
-- load and resize the background
local background = image_lib.load('background.png')
background = background.resize(screen.width, screen.height)
-- evaluates a half-transparent black color
local transparent = image_lib.color(0, 0, 0, 128)
-- loop until the user presses the left mouse button
while true do
    -- query the mouse
    x, y, left = input_lib.mouse()
    -- blit the background to the screen, covering all pixels
    background.blit(screen, 0, 0)
    -- fill a square with the half-transparent black
    screen.filled_rect(10, 10, screen.width - 10, screen.width - 10, 
transparent)
    -- update the screen
    screen.update()
    -- if left mouse button was pressed, break the loop
    if left then
       break
    end
end

. screen is obtained via SDL_SetVideoMode
. background is an 8bpp image loaded via IMG_LoadImage and resized via 
SDL_ResizeXY from Dave Olsen et al.
. the transparent color is obtained combining red, green, blue and alpha 
values into a single Uint32
. input_lib.mouse queries the mouse using SDL_GetMouseState
. background.blit blits the background image over another surface, in 
this a screen, using SDL_BlitSurface
. screen.update() calls either SDL_Flip or SDL_UpdateRect, I tried both 
in my tests

Thanks for the interest!

Andre
Andre de Leiradella | 1 Mar 2007 04:16
Picon

Re: SDL Digest, Vol 2, Issue 49

Hi Ryan,
> Short of stepping through it in a debugger and watching what function 
> got called when the FPU control register changed, I can't really guess. 
> Does DirectSound change it, too? You might be using that in SDL, even 
> with windib.
>
> Also, you can always forcibly change it back in your own app with 
> something like _controlfp() or an __asm__ block, once you figure out the 
> point where it's getting changed.
>
> --ryan.
>
>   
Great advice, I'll step through the code with a debugger and see when 
the FPU flags get changed.

Two questions:

1) Which audio drivers are available for Windows?
2) Is the FPU control register something I can change just by reading 
it, and'ing or or'ing with a mask and writing back the new value?

Thanks again,

Andre
Ryan C. Gordon | 1 Mar 2007 04:19
Favicon
Gravatar

Re: sdl only support fullscreen on embedded platform?


> If I use SDL to play video, SDL will put a black border around the LCD.
> Then I can not control the display of video.
> Have any method to solve the problem?

There's no way to get rid of the border, short of choosing a bigger 
resolution...the border is there because the hardware can't offer the 
resolution you want, so SDL is trying to accommodate you anyhow by 
choosing the closest hardware resolution and putting your SDL_Surface in 
the middle of it.

If you want to get rid of the black border, pick a resolution that the 
LCD supports (SDL_ListModes() can usually determine these for you).

--ryan.
Ryan C. Gordon | 1 Mar 2007 04:23
Favicon
Gravatar

Re: SDL Digest, Vol 2, Issue 49


> 1) Which audio drivers are available for Windows?

"dsound" and "waveout", which roughly correlate to SDL's "directx" and 
"windib" video drivers.

> 2) Is the FPU control register something I can change just by reading 
> it, and'ing or or'ing with a mask and writing back the new value?

Yes, but probably not in Lua directly. There's an x86/amd64 assembly 
instruction for reading and writing that register (and, from C, there's 
usually a non-standard function called _controlfp() or something similar 
to do the same).

If you can't figure out what's changing the control word, or you can't 
stop it from changing it, forcing it back yourself will probably Just Work.

--ryan.
Bo Liu | 1 Mar 2007 05:13
Picon

Re: sdl only support fullscreen on embedded platform?

Hi
 
Ryan wrote:
 

> I cross compile this application and run it on a 640x480 LCD. It works
> well with fullscreen scale. Then I wanted to test the non-fullscreen
> mode to see if sdl application can work well with framebuffer. A
> change was made to the video set section like:
> (screen=SDL_SetVideoMode(320,240,video_bpp,videoflags)
> The screen turns black as long as the changed application runs on board.

I assume this is Linux, using the fbcon driver.
 
Yes,it is.

Always use fullscreen on an embedded device that doesn't have a window
manager...if you set a 320x240 fullscreen mode on hardware that only
does 640x480, SDL will make a 320x240 window in the center of the
640x480 display, and put a black border around it.
 
Right.
If you try the test applications such as testbitmap, testwin....on desktop platform
 with changes to SDL_SetVideoMode as you like (you can even set it as 176x144,I've tried that), and the SDL will show the pic or video right in the center of the CRT. It really works.
 
But on my S3C2410 arm9 board, things get weird-----I have to set the 'x' and 'y' in the same size as my actual LCD, which means all SDL-based applications only support fullscreen now.....
I don't want to use the fullscreen mode...

Arguably, the fbcon target should just return NULL from
SDL_SetVideoMode() if you don't request SDL_FULLSCREEN or just force it
to fullscreen. I'll have to check that.
 
I will check the SDL_SetVideoMode() too.
thank you for your reply.
 
--
Liu Bo
Sichuan University
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Bo Liu | 1 Mar 2007 05:34
Picon

Re: sdl only support fullscreen on embedded platform?

Hi
 
ruihong wrote:
 

> > I cross compile this application and run it on a 640x480 LCD. It works
> > well with fullscreen scale. Then I wanted to test the non-fullscreen
> > mode to see if sdl application can work well with framebuffer. A
> > change was made to the video set section like:
> > (screen=SDL_SetVideoMode(320,240,video_bpp,videoflags)
> > The screen turns black as long as the changed application runs on
board.
>
>I assume this is Linux, using the fbcon driver.
>
>Always use fullscreen on an embedded device that doesn't have a window
>manager...if you set a 320x240 fullscreen mode on hardware that only
>does 640x480, SDL will make a 320x240 window in the center of the
>640x480 display, and put a black border around it.
>
>Arguably, the fbcon target should just return NULL from
>SDL_SetVideoMode() if you don't request SDL_FULLSCREEN or just force it
>to fullscreen. I'll have to check that.


I have the same problem.
If I use SDL to play video, SDL will put a black border around the LCD.
Then I can not control the display of video.
Have any method to solve the problem?
Thanks in advance and apologize to my poor english.

thanks for the reply.
what do you mean by "I can not control the display of video"?
now you can see the video or not?
what are the 'x' and 'y' value of your video file?
 

--
platinum.liu
Sichuan University
_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
呂 瑞鴻 | 1 Mar 2007 06:36
Picon
Favicon

Re: sdl only support fullscreen on embedded platform?


Hi~ Bo Liu

  What I do is that I use ffplay to display my video.
  And ffplay use the SDL library.
  When I use ffplay to play video, the widget of the ffplay can't be shown.
  So, I can't control the display while the video file is playing.

>now you can see the video or not?

Yes, I can see the video. But cant control it.
Before, I want to build SDL + qtopia to make the widget show.
But I always failed.
Anyone kowns how to make the SDK + qtopia work?

Thaks for your replay : )

>
>thanks for the reply.
>what do you mean by "I can not control the display of video"?
>now you can see the video or not?
>what are the 'x' and 'y' value of your video file?
>
>
>--
>platinum.liu
>Sichuan University

>_______________________________________________
>SDL mailing list
>SDL <at> lists.libsdl.org
>http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_________________________________________________________________
Windows Live Messenger 正式版熱烈下載中:共用資料夾,傳檔案再大也不怕 
http://get.live.com/messenger/overview 

_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
呂 瑞鴻 | 1 Mar 2007 09:17
Picon
Favicon

ffplay + SDL + qtopia does not work?

hello, 

I want to build ffplay on the device (architecture is arm).
In my device, the gui environment is qt-embedded.
I hope that ffplay runs by SDL with qtopia video driver,
but when I run it on the device, it doesn't work!

I trace the code, and it stop at the code :
SDL_qtopia_main.cc :
app = new QPEApplication(argc, argv);

when the program runs to the code, it will stop!
Does anyone know what to do?
If I don't use qtopia as the SDL video driver, I can't control the video 
while playing.

Thanks in advance,and sorry for my poor English.

_________________________________________________________________
超大 2GB 信箱容量 Windows Live Mail 搶鮮版:全新界面使用更方便 
http://ideas.live.com/programpage.aspx?versionid=5d21c51a-b161-4314-9b0e-4911fb2b2e6d 

_______________________________________________
SDL mailing list
SDL <at> lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Gmane