Trying to paint fullscreen

I’m trying to paint the full screen in a 640x480x16 mode with the
following code:

for (i=0;i<=19;i++) //X loop
for (j=0;j<=11;j++){ //Y loop
dest.x = 0+i32;
dest.y = 0+j
32;
dest.w = 32;
dest.h = 32;

   // Blit onto the screen surface
   SDL_BlitSurface(grass, NULL, screen, &dest);
   }

SDL_UpdateRect(screen, 0, 0, 0, 0);

But this only draws a square in the middle of the screen instead of
starting at left upper corner. Where did I failed?
I’m using SDL 1.1.4 and most of the code is taken from the few doc I have.–
Roger D. Vargas | "Humans have so many emotions, Artoo. And most
VQt Development Team | seem to cause them pain. I do not understand,
http://vqt.sourceforge.net | but I’m glad I have none. And yet – I can’t help
wondering sometimes… what it would be like."
C-3PO, Protocol Droid. Star Wars 2: World of Fire.

I guess that you are under X, aren’t you? It seems that no fullscreen mode is
available (use SDL_ListModes to list the available modes!), so the mode you
reached is a 640x480 box centered in your current X video resolution, the
border are filled with black :). When my program is in fullscreen, it reaches
such a “alternate” fullscreen mode. I don’t know why too. I don’t know if it
depends on your current X resolution and depth, or to the video card, or… or…

May be someone can tell us what is wrong about the availability of
REAL fullscreen modes under X?

Regards,

wwpOn Fri, 26 Jan 2001, you wrote:

I’m trying to paint the full screen in a 640x480x16 mode with the
following code:

But this only draws a square in the middle of the screen instead of
starting at left upper corner. Where did I failed?
I’m using SDL 1.1.4 and most of the code is taken from the few doc I have.

Roger D. Vargas wrote:

I’m trying to paint the full screen in a 640x480x16
mode with the following code:

But this only draws a square in the middle of the
screen instead of starting at left upper corner.
Where did I failed?

“Square” as in a single 32x32 tile or “square” as in many tiles with a big
black border? If SDL is not able to physically switch resolution it will
give you a big black rectangle at your desktop resolution (i.e. 1280x1024 or
whatever) and a smaller rectangle in the middle at your requested resolution
(640x480) where all blits go.

  • Randi

Regimental Command
Generic Armored Combat System
http://regcom.sourceforge.net

Le Fri, Jan 26, 2001 at 03:36:55PM +0100, wwp a ?crit :

I guess that you are under X, aren’t you? It seems that no fullscreen mode is
available (use SDL_ListModes to list the available modes!), so the mode you
reached is a 640x480 box centered in your current X video resolution, the
border are filled with black :). When my program is in fullscreen, it reaches
such a “alternate” fullscreen mode. I don’t know why too. I don’t know if it
depends on your current X resolution and depth, or to the video card, or… or…

May be someone can tell us what is wrong about the availability of
REAL fullscreen modes under X?

You just need to have the corresponding entries in your XF86Config.
For isntance, mine are
Subsection "Display"
Depth 16
Modes “1280x1024” “1024x768” “800x600” "640x480"
ViewPort 0 0
EndSubsection

Which allows me those 4 fullscreen modes.

Many tiles with black border, of course.On Fri, 26 Jan 2001, Randi J. Relander wrote:

“Square” as in a single 32x32 tile or “square” as in many tiles with a big
black border? If SDL is not able to physically switch resolution it will
give you a big black rectangle at your desktop resolution (i.e. 1280x1024 or
whatever) and a smaller rectangle in the middle at your requested resolution
(640x480) where all blits go.

Roger D. Vargas | "Humans have so many emotions, Artoo. And most
VQt Development Team | seem to cause them pain. I do not understand,
http://vqt.sourceforge.net | but I’m glad I have none. And yet – I can’t help
wondering sometimes… what it would be like."
C-3PO, Protocol Droid. Star Wars 2: World of Fire.

Yes, I’m under X, configured to 1024x700x8bpp and I want to change to 640
with 16 bpp, full screen, in any X configuration.On Fri, 26 Jan 2001, wwp wrote:

But this only draws a square in the middle of the screen instead of
starting at left upper corner. Where did I failed?
I’m using SDL 1.1.4 and most of the code is taken from the few doc I have.

I guess that you are under X, aren’t you? It seems that no fullscreen mode is
available (use SDL_ListModes to list the available modes!), so the mode you
reached is a 640x480 box centered in your current X video resolution, the
border are filled with black :). When my program is in fullscreen, it reaches
such a “alternate” fullscreen mode. I don’t know why too. I don’t know if it
depends on your current X resolution and depth, or to the video card, or… or…

Roger D. Vargas | "Humans have so many emotions, Artoo. And most
VQt Development Team | seem to cause them pain. I do not understand,
http://vqt.sourceforge.net | but I’m glad I have none. And yet – I can’t help
wondering sometimes… what it would be like."
C-3PO, Protocol Droid. Star Wars 2: World of Fire.

Hi folks,

May be someone can tell us what is wrong about the availability of
REAL fullscreen modes under X?

You just need to have the corresponding entries in your XF86Config.
For isntance, mine are
Subsection "Display"
Depth 16
Modes “1280x1024” “1024x768” “800x600” "640x480"
ViewPort 0 0
EndSubsection

Which allows me those 4 fullscreen modes.

Great, thank you a lot, will try this soon :slight_smile:

Thank you all for this smart support on da interesting ML

Regards,

wwp

You just need to have the corresponding entries in your XF86Config.
For isntance, mine are
Subsection "Display"
Depth 16
Modes “1280x1024” “1024x768” “800x600” "640x480"
ViewPort 0 0
EndSubsection
Yes, but my card only have 1MB, so, high resolution mode 1024x768 can work
just with depth 8. How can I define modes with depth 16 for 640x480?On Fri, 26 Jan 2001, Rouk wrote:


Roger D. Vargas | "Humans have so many emotions, Artoo. And most
VQt Development Team | seem to cause them pain. I do not understand,
http://vqt.sourceforge.net | but I’m glad I have none. And yet – I can’t help
wondering sometimes… what it would be like."
C-3PO, Protocol Droid. Star Wars 2: World of Fire.

Hi again Roger,On Sat, 27 Jan 2001, you wrote:

On Fri, 26 Jan 2001, Rouk wrote:

You just need to have the corresponding entries in your XF86Config.
For isntance, mine are
Subsection "Display"
Depth 16
Modes “1280x1024” “1024x768” “800x600” "640x480"
ViewPort 0 0
EndSubsection
Yes, but my card only have 1MB, so, high resolution mode 1024x768 can work
just with depth 8. How can I define modes with depth 16 for 640x480?

You don’t have to reach 16-bit video modes to make your 640x480x16 mode to work
in fullscreen!
First, it was Rouk’s X11 configuration file, shown as example.
Second, if you say 640x480x16, it means that your wished mode is 16… colors,
not 16-bit.

16-color need 4-bit, but X supports 8-bits minimum, 16-bit is 32768 colors :).
But your 16-color mode can be safely reached in 8-bit (256 colors) modes, as you
can.

The maximum resolution and depth that you video card supports can be
calculated like that:
x = video_mode.width * video_mode.height * MIN(1, video_mode.depth_in_bits /
8).
If x <= video_card.memory_size, it’s THEORICALLY okay, else… you have to
decrease the resolution or the depth, or to increase your video card.
For instance: x=6404801=307200 (bytes); it seems to be okay with your video
card, as well 1024x768x8 works too).

cheers,

wwp

Roger,

Arg! You will have noticed a mistake in my previous e-mail… 16-bits allows
65536 colors, and not 32768 (of course).

sorry :slight_smile:

wwp

Yes, I’m under X, configured to 1024x700x8bpp and I want to change to 640
with 16 bpp, full screen, in any X configuration.

You are completely at the mercy of the video modes defined by the user
(or their Linux distribution). Unless you are using the DGA driver,
which only works fullscreen with XFree86 4.0 and root privs, you also
cannot switch bit-depths on the fly.

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