Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pvallet

Pages: [1]
1
Graphics / Re: Loading indexed images with transparency
« on: June 07, 2017, 01:47:46 pm »
Quote
If game use indexed palettes you never fit into with colors.

Yes indeed that would be quite difficult to work with game color palettes, but in this case the palettes are stored in each image so I don't need to worry about my colors being modified. I still gain a lot of space though.

2
Graphics / Re: Loading indexed images with transparency
« on: June 07, 2017, 01:09:09 pm »
Why is it a pain from the past ? It seems to me that the indexed encoding is a good lossless compression algorithm, and should not be that hard to support.
Quote
And you can get better result that with

Ah yes that's pretty neat. I'll check pngcrush (pngopt seems to be only a wrapper of pngcrush).

3
Graphics / Re: Loading indexed images with transparency
« on: June 07, 2017, 11:14:19 am »
If this is an SFML internal bug should I raise a github issue ?

4
Graphics / Re: Loading indexed images with transparency
« on: June 06, 2017, 03:55:00 pm »
Here it is !
There is a small readme to build it on linux.

It uses a texture array instead of several textures, I hope it is still minimal enough for you. As there are VAOs and VBOs the code also works on OpenGL 3.3 (core) and thus should run on OS X.

5
Graphics / Re: Loading indexed images with transparency
« on: June 06, 2017, 01:58:05 pm »
Ok I'll try to come up with a minimal code that reproduces the error. This might take a bit more time as I'm currently using OpenGL only.

6
Graphics / Re: Loading indexed images with transparency
« on: June 06, 2017, 01:46:01 pm »
Oh sorry, these were sprite sheets I converted to avoid indexed colors.

Here are the indexed ones

Edit: I looked at the palettes using GIMP.

I'm sorry about the explanation, I hope it's a bit more understandable now.

7
Graphics / Re: Loading indexed images with transparency
« on: June 06, 2017, 01:42:14 pm »
These are screenshots from my rendering engine.

Here are the png loaded by the engine

8
Graphics / Re: Loading indexed images with transparency
« on: June 06, 2017, 01:14:44 pm »
Ok I'll try to explain it better.

The images are stored as png, and the transparent pixels are (0,0,0,0) (a truly transparent background). When loading, SFML sometimes converts those pixels to (somebluecolor, 0), which yields the blue background instead of the expected black one (when I render with transparency disabled).

9
Graphics / Loading indexed images with transparency
« on: June 06, 2017, 12:06:12 pm »
Hello everybody,

I'm working on a SFML + OpenGL project that uses age of empires sprites (with indexed colors) and transparency. However when loading the images some weird artifacts appear. The alpha channel seems to modify the rgb channel on loading.

This is an OpenGL render without glblend where the texture behaves as expected: the transparent pixels have a black color.

See aoe1.png (I'm sorry I don't know how to integrate the image in the post).
The palette can be seen on aoe1_palette.png

But when using age of empires 2 palette, it gives some blue color to the transparent background, as seen on aoe2.png
The palette is aoe2_palette.png

Note that the color of the background is not present on the palette (even though some are close). The same effect appears with a custom palette.

It does work with unindexed color though, and I'll eventually come to using it, but I feel like it's a huge waste of space.

Edit: I'm using SFML 2.4.2 and the bug appears on Linux, Mac OS and Windows

Thanks in advance for your help !

Paul

10
Window / Re: gl Viewport oddly translated downwards when using fullscreen
« on: November 18, 2016, 01:19:42 am »
Yes, the problem is indeed solved with the version 2.4.1

Note that with the version 2.4.0, there is no black strip on the top, but when clicking, the position of the mouse is also translated downwards.

11
Window / Re: gl Viewport oddly translated downwards when using fullscreen
« on: November 16, 2016, 01:50:07 am »
I am using SFML 2.3.2 (the one from the repository of Ubuntu 16.04). As for my window manager, the file /etc/X11/default-display-manager contains /usr/sbin/gdm3

The code that I was explaining was minimal in the sense that when testing the size of the window right after generating it, I got a height of 715 instead of 766.

Here is a simple code reproducing the bug. The bug does not occur every time. I have two kind of displays, as shown in the attachment, one with a translated rectangle and the other with the normal white rectangle (there seems to be some kind of other bug but this is not the point here).
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

int main() {
  sf::ContextSettings context(24, 8, 4, 3, 0);
  sf::RenderWindow window(sf::VideoMode::getFullscreenModes().front(), "OpenGL", sf::Style::Fullscreen, context);

  sf::RectangleShape test(sf::Vector2f(200, 20));
  test.setFillColor(sf::Color::White);
  test.setPosition(sf::Vector2f(0,0));

  while (true) {
    window.draw(test);
    window.display();
  }

  return 0;
}

I am now using some kind of workaround: as my problem only appears sometimes, I just have to recreate the window until it is as I want it to be. This does not really solve the problem though.

sf::RenderWindow window;
for (size_t i = 0; i < 20; i++) {
  window.create(sf::VideoMode::getFullscreenModes().front(), "OpenGL", sf::Style::Fullscreen, context);
  if (window.getSize().y == sf::VideoMode::getFullscreenModes().front().height)
    break;
}



12
Window / Re: gl Viewport oddly translated downwards when using fullscreen
« on: November 15, 2016, 07:03:52 pm »
I'm on ubuntu 16.04 right now but if I remember well the problem also appears on windows.

I am using custom OpenGL indeed, but when I turn it off to leave only the minimap and the FPS counter, everything remains the same.

13
Window / gl Viewport oddly translated downwards when using fullscreen
« on: November 15, 2016, 06:07:19 pm »
Hello everybody,

I came across an odd problem while using fullscreen with the SFML:

Sometimes when launching my program, the gl viewport turns out translated downwards, leaving a black strip on the top. (about 50% of the time everything works fine). Here is a picture attached to illustrate it.

I create my window using
sf::ContextSettings context(24, 8, 4, 3, 0);
sf::RenderWindow window(sf::VideoMode::getFullscreenModes().front(), "OpenGL", sf::Style::Fullscreen, context);

The fullscreen mode is always 1366x768x32. When the problem appears, the size of the sf::View associated with the sf::RenderWindow is cropped to 1366x715, which translates the FPS counter but keeps the minimap whole (not cropped on the bottom).

When I click, OpenGL handles my click as if it was translated downwards, too, even on the minimap.

Changing the view or the size of the window only changes how the 2D elements are draw, the black strip on the top stays unchanged.


Would you have any idea on how to fix this ?


Thanks

Pages: [1]