bugBos Wars - Bugs: bug #28728, DrawTexture sometimes stretches a...

 
 

bug #28728: DrawTexture sometimes stretches a lot

Submitted by:  Kalle Olavi Niemitalo <kon>
Submitted on:  Sun 24 Jan 2010 09:35:38 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: François Beerten <feb>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 23 Feb 2010 09:04:51 PM UTC, comment #4:

First patch applied.

The second error is caused by a bad definition of the units. They have to define NumDirections at 1.

Thank you for the report, the analysis and the patches.

François Beerten <feb>
Project AdministratorIn charge of this item.
Mon 22 Feb 2010 10:21:10 PM UTC, comment #3:

Unfortunately, file #19775 caused an assertion failure in the map editor. Please apply the following patch as well.

0002-Use-exact-frame-in-animations-building.patch
[PATCHv2 2/2] Use exact-frame in animations-building

(file #19781)

Kalle Olavi Niemitalo <kon>
Project Member
Mon 22 Feb 2010 08:01:48 PM UTC, comment #2:

Some observations about the "totally incorrect rendering" (screen shot attached) with this patch (file #19543):

- It happens also without this patch.

- It happens with this patch even if I define LIBGL_ALWAYS_INDIRECT=1.

- It does not happen with this patch if I unload and hide the "drm" Linux kernel module.

Thus, I now think this patch is safe to apply; the bug is not in the patch but rather in Mesa or in the Linux driver for ATI Mobility Radeon HD 4570, and the patch does not make it worse.

However, I added some more assertions to DrawTexture while trying to find bugs in it, so I'm also attaching a new version (v2) of the patch.

(file #19774, file #19775)

Kalle Olavi Niemitalo <kon>
Project Member
Sun 24 Jan 2010 10:19:41 PM UTC, comment #1:

Here is my attempt to rewrite DrawTexture. It does fix this bug and is better commented than the original but I am not sure it doesn't cause new bugs. In particular, I've been seeing mysterious slowdowns and totally incorrect rendering at some scrolling positions. My attempts to debug that have repeatedly locked up the computer (or at least X11). I suppose this should be debugged over the network, but I don't think I'll have time for that before the next weekend, so I'm posting the patch as it is now.

(file #19543)

Kalle Olavi Niemitalo <kon>
Project Member
Sun 24 Jan 2010 09:35:38 PM UTC, original submission:

In https://savannah.nongnu.org/bugs/?28727 I suggest changing Bos Wars to split graphics into smaller OpenGL textures than it does now. Unfortunately, this change reveals a bug in DrawTexture. That function takes a CGraphic, which may consist of multiple OpenGL textures, and draws the specified part of it to the screen. Normally, DrawTexture should copy the pixels of the textures as they are and not stretch them. However, in some circumstances, it apparently does stretch the textures. This manifests in Bos Wars drawing the background of the map incorrectly when the map is scrolled to some positions. A typical effect is that, as you scroll the map up and down, some part of the background image remains attached to the bottom of the viewport and does not move with the map; the rest of the image then stretches to cover the viewport.

To reproduce:
- Patch InitOpenGL to set GLMaxTextureSize = 1024 if it's larger.
- Select 640x480 in the video options and enable OpenGL. Restart Bos Wars if necessary.
- Start the map editor and load bridge.map.
- Use the arrow keys to scroll from any edge of the map to the opposite one. The stretching will be plainly visible.

I have reproduced the bug with both software and hardware OpenGL rendering. Because DrawTexture is specific to OpenGL, the bug does not happen if OpenGL is disabled in the Bos Wars video options.

Debian testing, Bos Wars trunk r9623 debug, libsdl1.2debian 1.2.13-5, xserver-xorg 1:7.4+4, xserver-xorg-video-ati 1:6.12.3-1, xserver-xorg-video-radeon 1:6.12.3-1, xserver-xorg-video-radeonhd 1.2.5-1, libgl1-mesa-dri 7.6.1-1, linux-image-2.6.32-trunk-amd64 2.6.32-5, Acer Aspire 5536G, ATI Mobility Radeon HD 4570, 512 MB video memory of which 256 MB visible to CPU.

Kalle Olavi Niemitalo <kon>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #19781:  0002-Use-exact-frame-in-animations-building.patch added by kon (1KiB - text/x-patch - [PATCHv2 2/2] Use exact-frame in animations-building)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by feb (Posted a comment)
  • -unavailable- added by kon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 23 Feb 2010 09:04:51 PM UTCfebStatusNone=>Fixed
      Assigned toNone=>feb
      Open/ClosedOpen=>Closed
    Mon 22 Feb 2010 10:21:10 PM UTCkonAttached File-=>Added 0002-Use-exact-frame-in-animations-building.patch, #19781
    Mon 22 Feb 2010 08:01:48 PM UTCkonAttached File-=>Added wrong-textures-in-islandwar-640x480.png, #19774
      Attached File-=>Added 0001-Rewrite-DrawTexture-not-to-stretch.patch, #19775
    Mon 15 Feb 2010 09:27:54 PM UTCfebDependencies-=>Depends on bugs #28736
    Sun 24 Jan 2010 10:19:41 PM UTCkonAttached File-=>Added 0001-Rewrite-DrawTexture-not-to-stretch.patch, #19543

    Back to the top


    Powered by Savane 3.1-cleanup1