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 - mkalex777

Pages: 1 [2] 3 4 ... 14
16
General / Re: SFML And Emulator
« on: January 20, 2016, 09:52:28 pm »
If you want to make emulators then sfml and sdl are bad choice you need some low-level graphics api like pure opengl to make emulator, vecause you need to "translate" the bute code to of executable. To translate it you need to provide an alternative to functions that it calls. For exmaple on original platform we have a call to procedure graphics_create_texture, how will you handle it with sfm? You need normal Opengl function - glCreateTexture. If you still misunderstood this then you should understand how wine emulator works.

What? Huh?

He is asking about a Gameboy emulator. As for needing 'pure opengl' you still need a windowing library to use OpenGL. Even if he wanted to write pure gl code he still needs SFML/SDL/GLFW. Next time please understand the question before writing stuff that doesn't make much sense. SFML will be fine for what the OP wants to do.

Pure opengl will be better, actually there is no need for these bloated frameworks with 10-100 megabyte libraries just to open opengl window :)

17
Graphics / Re: Shader crash on some Intel GPUs
« on: January 19, 2016, 09:31:18 am »
I read some article about intel chipset and it has a little strange opengl driver. It may change gl extension function pointers after call to wglMakeCurrent. I didn't investigated on what is going on with intel graphics, but some peoples recommend to reload gl extensions after each makecurrent call...

18
Window / Re: How to "unfreeze" a window while dragging it
« on: January 09, 2016, 10:51:41 pm »
It's too complicated task to render window in usual way while resizing. But if we support rendering of some static scene it will be looks good enough.

Currently I'm working on my own OpenGL wrapper and learning OpenGL internals.
I've found that OpenGL contexts with extensions is real holly shit... :)
DirectX API with it's own COM interfaces looks much easier in comparison to those OpenGL kludges :)

Also I've found that OpenGL cannot render it's content into window which is in resizing state and has double buffer flag.
It seems like the reson why SFML doesn't provide any way to render window in resizing state.
I've found nice solution for this issue.
You can handle WM_SIZING and WM_SIZE messages in order to catch resize begin and resize end events.
When you catch resize begin event, just reset double buffering flag and reenable it back on resize end.
Actually I'm using WinForms events Form.OnResizeBegin and Form.OnResizeEnd.
It works very good. It allows to use double buffered window to avoid tearing effects and to render content while window is in resizing state.
I implemented RenderRequest event which is raised when a system sends WM_PAINT message from internal message loop (I just set internal flag before dispatch window messages and reset it when it's done, so my event is raised in resizing state only). So, I'm using it to render static scene in resizing state.
Yes, it doesn't allow to update game state like in usual game loop, so the game will freeze, but it still render current state into the window.




19
Window / Re: Is sf::Window support dpi scaling on Windows?
« on: January 09, 2016, 10:30:34 pm »
SFML doesn't support dpi settings, because it uses call to SetProcessDpiAwareness, so all SFML sizes is fixed to the physical pixel size. In order to support dpi settings you need to read system dpi settings and scale your view according to it (with help of View.Zoom for example).

20
Just read some discussions about D2D internals and it seems that it's really using it's own antialiasing which is highly criticized for high cpu usage. It uses some heavy tessellation which splits even simple line into thousands of triangles and doing it on cpu. As result, it's complicated to make high performance for a lot of primitives with enabled antialiasing on D2D, because it leads to processing millions triangles inside D2D.
But result of D2D rendering is really impressive. I just implemented a small test to render outline texts, and it looks really cool. And the code is pretty easy, because all things to build outline geometry is done with several D2D calls. And the most cool thing is that D2D works good enough even with generating geometry just in real time. SFML lags like hell when I tried to render text with different sizes in real time. So, I implemented single text instance with fixed font size and scale it to desired size in render code. But with D2D it works well just out of the box with no any optimizations and with no need to scale.
Here is how the text looks with D2D (unfortunately I cannot achieve the same result with SFML):


The bad thing is that D2D can run on windows only :(

But my question is still open. How I can improve antialiasing with using SFML?

21
Quote
I think it's not "just OpenGL", because OpenGL MSAA depends on many opengl settings (and it's configuration sequence) which is configured by SFML
Not really... SFML enables multi-sampling if you tell it to, and uses the number of samples that you set in sf::ContextSettings. That's it for the "many OpenGL settings".

But if you have a good understanding of OpenGL anti-aliasing, and you think we do it the wrong way, why don't you test it yourself and try to come up with a better "configuration sequence"? That would be much more relevant than comparing the result to some other API about which we know nothing.

I'm noob in opengl. I just see poor antialiasing and trying to understand how to fix it :)
I see that D2D has much better MSAA. I'm not sure but I think that MSAA should works with the same quality (ok, with minor +-) on opengl and d2d. Because it uses the same technique (and probably the same code). But test shows that it works much worse. Why?

22
"SFML antialiasing" is just OpenGL multi-sampling. There's nothing much we can do...

I think it's not "just OpenGL", because OpenGL MSAA depends on many opengl settings (and it's configuration sequence) which is configured by SFML. I read about some issues which happens with OpenGL MSAA with some specific combination of opengl settings.

For example:
Quote
opengl antialiasing does not work properly in recent processing versions unless you
first do a " hint(DISABLE_OPENGL_2X_SMOOTH);" Then you can reenable it or
smooth() or whatever. If you don't disable it first, you don't get the
best AntiAlias quality.

I'm not sure if it's the root of cause, because this commet was related to another software, but incorrect configuration may leads to poor antialiasing

Just look at this test example:
(click to show/hide)

Here is D2D test source:
(click to show/hide)

D2D test sample uses my wrapper, here is some code to understand what happens under the hood:
(click to show/hide)


Results:

(click to show/hide)

(click to show/hide)

SFML screenshot shows that antialiasing is very poor

23
I found strange issue with SFML antialiasing.
Here is screenshot (I used the same source with static scale=1):
(click to show/hide)

All lines were drawn with Color.Black. But as you can see, SFML antialiasing changes color to grey incorrectly.
While D2D antialiasting shows still black lines.


Here is a small fix in DrawLine function (with line thickness).
It works incorrectly, because draws line 2x times bold.
With using it, SFML result looks very close to D2D.

        public static void DrawLine(
            RenderTarget target,
            Vector2f start,
            Vector2f end,
            float strokeWidth,
            Color color)
        {
            var dv = end - start;
            var dl = (float)Math.Sqrt(dv.X * dv.X + dv.Y * dv.Y);
            var uv = dv / dl;
            var up = new Vector2f(-uv.Y, uv.X);
            var offset = up * strokeWidth;
            var array = new[]
            {
                new Vertex(start + offset, color),
                new Vertex(end + offset, color),
                new Vertex(end - offset, color),
                new Vertex(start - offset, color),
            };
            target.Draw(array, PrimitiveType.Quads);
        }
 

Here is comparison between SFML and D2D antialiasing:
(click to show/hide)

As you can see, the image is very close. But...
There is an issue with line jitter for both - SFML and D2D. May be it's related to precision of float value.

With take into account this issue, D2D antialiasing works great. It shows all lines with no skip.
But there is another picture for SFML - some lines just disappearing.
So, it's definitely SFML antialiasing issue.

24
Tried the same test on D2D with using built-in RenderTarget.DrawLine function, it works a little better (moire is not so high like with SFML example), but it's still exists.

Here is screenshot with comparison between SFML and D2D:
(click to show/hide)

Here is screenshot with comparison for the last frame in the animation:
(click to show/hide)

As you can see D2D antialiasing works much better, but it's still has some issues.

I read some articles on the internet and it seems that it's impossible to render good antialiased line with using of standard MSAA. I found some suggestions to implement DrawLine with shaders. I didn't worked with shaders before. Can anyone help me with examples on how to utilize it for DrawLine function?

25
here is short example which demonstrates the issue:

(click to show/hide)

I tried different ways but didn't found any solution to this.
Those distortions and moire looks very bad with some scale values.
Could you please help me to eliminate those weird distortions?

May be there is any way to fix it with some kind of shaders and post processing effects?

Also it looks much worse on the system which doesn't support MSAA (OpenGL 2.3).
Is there any way to fix it? May be there is any kind of software MSAA?

Here is screenshot:

26
Graphics / Re: Collision not detected
« on: December 27, 2015, 05:28:30 am »
Just post problematic rectangle coordinates and size. But it seems that there is a problem with object physics (high speed relative to update interval), but not with FloatRect

27
Window / Re: How to "unfreeze" a window while dragging it
« on: December 21, 2015, 07:07:57 pm »
Laurent could you please add callback to allow render window while window in resize loop? Just call it from WM_PAINT message. So, we can set this callback with minimal render function which will works in resize mode. For sfml.net it will be cool to implement it as event.

it will be cool feature, because we can make window without artefacts and garbage...

28
General / Re: Write to Console While Out Of Focus/Hidden?
« on: December 08, 2015, 11:54:51 pm »
That doesn't make sense -- according to this logic, it wouldn't be possible to work with the console in any C++ application.

No, you can use existing console behavior through console api functions, but you will not be able to change something, because console window is hosted in separate process. It means that you will need to inject your code into another process and to implement inter process communication in order to change something ( for example to hook wndproc, add custom menu handler or something like that). It will be much complicated than implementing your own custom console.


29
General / Re: Write to Console While Out Of Focus/Hidden?
« on: December 07, 2015, 08:12:56 pm »
It's impossible with console, because it hosted in separate process (out of application). But you can handle input in active window (TextEntered event for sfml) and then you can write your string into redirected CONIN stream. In such way you can handle text input with sfml window and then pass it to the hidden console window, so your function getline will read it from your code instead of console.

30
DotNet / Re: Box2DX and SFML .Net
« on: December 07, 2015, 07:28:07 pm »
Any news?
I found that box2dx cannot handle properly colisions between circle and rectangle body shape. May be anyone know on how to fix it

Pages: 1 [2] 3 4 ... 14
anything