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 ... 14
Graphics / How to draw Texture with black and white colors?
« on: February 22, 2019, 10:41:45 am »
I draw Texture on circle shape and it works. All textures are colored.
But I want to draw it with black and white tints in some cases.
Is it possible with no need to modify image and no need to load second copy of texture (black and white version)?

DotNet / Re: High CPU usage with very basic SFML program
« on: July 25, 2017, 04:04:36 pm »
So until you are ready to prove how the functionality differs or do your own debugging as to why you think SFML.Net is responsible for something that is simply not the case, stop spreading your false information.

I don't know why, but there is a difference.
I was used program with a lot of geometry drawing (lines, circles, rectangles) for testing.
I added call SetFramerateLimit(0) at program initialization and tried to run the program with this call and without (just commented it).

With the call SetFramerateLimit(0) I got 0% CPU load in the task manager.
When I commented this call, I got 25% CPU load (100% load for single CPU core).
I don't know the reason. May be there is OpenGL issue, may be there is SFML issue.
But the difference definitely exists.
In order to decrease CPU load, there is need for an explicit call to SetFramerateLimit(0).

DotNet / Re: SFML.NET 2.4 Update
« on: July 25, 2017, 03:48:16 pm »
No need to make the internal code depend on new language features when it changes nothing for the end user, and only restricts the environments where SFML.Net can be compiled.

Totally agree, this is terrible when the code consists of such kind features and cannot be compiled with popular compillers.

Graphics / CSFML 2.3 render text GetLocalBounds bug
« on: May 29, 2016, 04:25:32 pm »
I'm using UbuntuMono-R.ttf
MD5: 9383F4B0BC1D264A5A7E094EB1ED0C0B
Link: http://db.onlinewebfonts.com/t/9383f4b0bc1d264a5a7e094eb1ed0c0b.ttf

It's monospace font, and it works fine with different strings - all letters with the same size.

But now I found two strings, for which Text::GetLocalBounds returns incorrect sizes.
It happens with Text::CharacterSize = 20.


string "Level:" => size = [59; 26] (bounds = [FloatRect] Left=2; Top=6; Width=55; Height=14)
string "Xp:   " => size = [60; 30] (bounds = [FloatRect] Left=0; Top=7; Width=60; Height=16)

I'm calculate text size from bounds with the following code:
        public static Vector2f MeasureText(this Text text)
            var bounds = text.GetLocalBounds();
            var size = new Vector2f(bounds.Width, bounds.Height);
            var padding = new Vector2f(bounds.Left, bounds.Top);
            return size + padding * 2F;

For both strings GetLocalBounds should return the same size.

Is it really CSFML 2.3 bug? Or may be it's just incorrect way to calculate the text size?
How to fix it in order to get the same size for both strings. Because the font is monospace.

DotNet / Re: High CPU usage with very basic SFML program
« on: May 12, 2016, 02:11:25 am »
there never was, never has been a bug that required you to call SetFramerateLimit if you didn't plan on using it.

you're posting false information.
If you don't call SetFrameLimit(0) you will get high CPU load even with SetVerticalSyncEnabled(true).
At least SFML.NET has this issue.

This topic is related to SFML.NET which has this issue 100%, so please stop posting false information.

DotNet / Re: Multi-threaded rendering SFML .net
« on: May 12, 2016, 02:07:19 am »
but there's no sfml thread in C# version of SFML.
C# has native threads.

actually it has managed thread. Managed thread != native thread, but it provides all functionality which is needed

Window / Re: Interprocess Comunication (SendMessage / GetMessage)
« on: March 26, 2016, 02:51:32 pm »
You can use sockets. SFML implements some wrappers for network. But I didn't used it, because dotnet already provides System.Net namespace with all what you need. Also you can use WCF, it allows you to use pipe or tcp channel.

I don't recommend you to use shared memory or window messages, because it will be pain to port such app to another platform

DotNet / Re: High CPU usage with very basic SFML program
« on: March 26, 2016, 02:29:53 pm »
It's old SFML bug. You should call setframelimit even if you don't using it (just pass zero). Otherwise you will get high cpu usage. And you should not use vblank sync and frame limit simultaneously.

So, try to use:

It help me to solve this issue

System / sfml.net crash in opengl.dll module
« on: February 17, 2016, 10:39:33 am »
I found issue with opengl crash. It happens when app was working in fullscreen mode and system is going into sleep mode. App was worked for several hours. I catch it on Windows 7.

App crash was reported by system in the module opengl32.dll:
Faulting application name: Client.exe, version:, time stamp: 0x56c36bff
Faulting module name: OPENGL32.dll, version: 6.1.7600.16385, time stamp: 0x4a5be02b
Exception code: 0xc0000005
Fault offset: 0x00000000000dd064
Faulting process id: 0x1298
Faulting application start time: 0x01d168fb82708356
Faulting application path: G:\SRC\_binrelease\Client.exe
Faulting module path: C:\Windows\system32\OPENGL32.dll
Report Id: ed8b0910-d558-11e5-8c29-005056c00008

I'm using SFML.NET binding (CSFML 2.3)

Before this crash the following error was happened:
Application: Client.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at SFML.Graphics.Context.sfContext_create()
   at SFML.Graphics.Context.sfContext_create()
   at SFML.Graphics.Context.get_Global()
   at SFML.Graphics.Texture.Destroy(Boolean)
   at SFML.ObjectBase.Dispose(Boolean)
   at SFML.ObjectBase.Finalize()

It seems like invalid finalizer implementation

Window / Re: Short flicker during program load when on the Main Display
« on: January 31, 2016, 01:06:36 pm »
at a glance, it seems that your issue related to display mode change.
Try to replace Style.None with Style.Default. I think it will eliminate your flicks.

Something like that:
sf::RenderWindow window(sf::VideoMode(800, 600), "Test", sf::Style::Default);

If you need to switch into fullscreen mode, then use this code:
sf::RenderWindow window(sf::VideoMode::DesktopMode, "Test", sf::Style::Fullscreen);

But the last code leads to display flicker due display mode change

Graphics / Re: .net change from Close to Fullscreen
« on: January 22, 2016, 03:18:50 pm »
How would I make it so it knows what events to set up because I have different events depending on what screen I'm on?

your program is only one who knows what events is needed for you.

You can do it in the following way:
if (e.Code == Keyboard.Key.F11)
      _isFullscreenChangeRequest = true;
public void Main()
   while (window.IsOpen)

       if (_isFullscreenChangeRequest)
           _isFullscreenChangeRequest = false;
           _isFullscreen = !_isFullscreen;

private void CreateWindow()
        // first we need unsubscribe from all events
        window.Resize -= Window_OnResize;
        window.KeyPressed -= Window_OnKeyPressed;
        // then we need to dispose window
        window = null;

        // and now we can create new one
        window = new new RenderWindow(
            _isFullscreen ? new VideoMode(PrimaryScreen.X, PrimaryScreen.Y) : new VideoMode(1280, 720),
            "RogueLike 2D " + context.MajorVersion + "." + context.MinorVersion,
            _isFullscreen ? Styles.Fullscreen : Styles.Default,
         // and now you need to subscribe for events on a new window
        window.Closed += (s,e) => window.Close();
        window.Resize += Window_OnResize;
        window.KeyPressed += Window_OnKeyPressed;

Unfortunately you cannot do all thins inside keypressed event due to the bug in SFML. (If you will try to dispose window from keypressed event it will leads to access violation error).
So, you need to notify the main loop about the change you need and then you can do all things safely from the main loop.

This sample is a little simplified and has some minor issues. Look for my topic here http://en.sfml-dev.org/forums/index.php?topic=19026.0
You will find good working example source code at the end of this topic.

Graphics / Re: .net change from Close to Fullscreen
« on: January 22, 2016, 03:15:15 pm »
first step you need to unsubscribe all events from previous render window,
second step you need to dispose previous render window
third step you need to create new render window and subscribe for events for it.

So, you're doing it in the wrong way, because you didn't unsubscribed from events, didn't disposed old render window. It means that it still exists, still works and consuming memory and may raise events

Graphics / Re: Layers and camera
« on: January 20, 2016, 10:47:38 pm »
I think it will be better to incapsulate view inside layer implementation. It's too hard to read the code. I used layered rendering with sfml in the following way:

foreach(var layer in _layers)

each layer know how to render itself. For example, here is how Layer.Draw is implemented:
public void Draw(RenderTarget target)
   foreach(var item in _items)
      DrawItem(target, item);

Graphics / Re: Shader crash on some Intel GPUs
« on: January 20, 2016, 10:12:16 pm »
I read some article about intel chipset...
If you don't even bother linking the source your statements are quite useless, since the article could've been about all kinds of things...

Sorry, I didn't save the link, recently I read a lot of things about init gl extensions because I'm debugging my own cross platform library. So, I don't remember exactly where I found it.

Try to get shader loginfo and program loginfo when running it on intel chipset, may be it consist of some info

Graphics / Re: Global blur
« on: January 20, 2016, 10:00:14 pm »
Probably the better way to implement blur is shaders, it will looks much better with dynamic effects

Pages: [1] 2 3 ... 14