Author Topic: (fixed)Problem with colorpicking / OpenGL knowledge needed  (Read 655 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
I am still woking on making the colorpicking method better, as its more compatible nowadays.

But I still get a strange "screenshot" when I render for colorpicking.

This is what I originally selected:
http://www.titusgames.de/tmp/screen126.jpg

and this is what the render for colorpicking looks like in this moment:
http://www.titusgames.de/tmp/color.png

Do you have any idea why it looks like this ? What did I maybe do wrong ?
« Last Edit: 28 April 2013, 00:45:57 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
(fixed)Re: Problem with colorpicking / OpenGL knowledge needed
« Reply #1 on: 28 April 2013, 00:45:38 »
I fixed it :D.

The reason was that the size fo the pixmap needed for colorpicking ( for the glReadPixels) was set to +1 in width and heighth.
I found out that this was done becuase otherwise the game crashed on low resolution.

But why did it crash ? It crashed because of rounding problems resulting in 0x0 or 0x1 or 1x0 size pixmaps which resulted in a crash with  opengl....
I now set the selection size to a minimum of 2x2 pixels. So even with rounding errors we get at least 1x1 pixels !
On a side efefct I think exactly this is the reason for random false selects when attacking units with right mouse click, because inside a 0x0  you will never find a unit ! ( but we will see if this is is/was the reason )

So its fixed now and i am happy  ;D :O :D
« Last Edit: 30 April 2013, 08:09:32 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

 

anything