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

Pages: [1] 2
1
Thanks for the tips!

Quote
Why don't you resize the view like you are supposed to do?
I don't know how I missed that section of the View tutorial, but that would probably do the trick. Ideally the RenderControl would work when its DockStyle was set to fill, but that caused a lot of trouble initially... I'll give this a try and report back.

Quote
You never dispose the old window
Good catch. Ran into trouble when testing before I'd finished the class, and must have missed that.

Quote
Not to mention SFML doesn't exactly play nicely with threads in some situations, so I don't understand why you have all these monitor calls all over
This control will eventually be incorporated into an application where rendering runs in a separate thread than the GUI, as is necessary to keep the GUI from hanging when using a rendering loop. After I shifted construction of all OpenGL-related objects to the rendering thread I haven't had any trouble when using SFML in my multithreaded app... if you have/know of any specific concerns, I'd be happy to hear them, though!

As for their purpose: if the GUI thread calls Destroy/Create at the same time the rendering thread calls Draw (or something) then we might have a race - if m_Window.Dispose had been called but m_Window hadn't yet been set to null, for example, we might try to draw to the disposed object (right...?). These will probably be converted into something more elegant, but during testing they will stay there.

Quote
Why don't you just store a context setting struct as a member variable
I had been considering making these changeable, but then I noticed that SFML doesn't let you do this and figured I shouldn't either. In retrospect I don't really know why you'd want to change them anyway. That will be fixed as soon as the more important bits are taken care of.



EDIT: Altering the view as suggested in that tutorial works wonderfully - thanks for the link.
At this point, zsbzsb, I practically owe you a co-author credit on my application ;)

As it stands I believe the class to be fully functional - if there are other concerns to be considered in a multithreaded application, though, I might need to make some changes (e.g. I am not entirely sure which of the built-in RenderWindow functions won't lead to a race, so some uses of Monitor might be unnecessary). I might just do away with the Monitor stuff entirely and assume that it will be handled externally (if needed), as this is more in line with what is expected of SFML.

Feel free to toss any other suggestions my way - revised code below.

(click to show/hide)

2
DotNet / Crash during resize of UserControl with embedded RenderWindow
« on: April 07, 2015, 05:50:17 am »
I'm creating a UserControl for use in a WinForms application which embeds and displays a RenderWindow using the method suggested in this forum post. Everything works well so far except when the control is resized. When the control is resized I want to recreate the embedded RenderWindow with a VideoMode that won't result in stretching, but this often results in the program crashing with no exceptions thrown... VS2013 gives me nothing to work with but a "vshost.exe has stopped working" message. I'm at a complete loss - any ideas for troubleshooting or fixing this are very, very welcome. The pertinent code is below.

(click to show/hide)

(click to show/hide)

(click to show/hide)

3
I haven't been able to produce a short, verifiable example, but it is looking like this might be related to using SoundRecorder instances as members of a form (likely WinForms being a pain, I figure?). Adding the following to the form's closing event fixes the issue:

private void FFTWindow_FormClosing(object sender, FormClosingEventArgs e)
{
    this.sampler.Stop();
}

As long as the processing thread is stopped directly as above, no trouble. Not entirely sure why this would happen, but I don't mind needing this workaround.

4
Quote
Which doesn't make much sense considering the dtor is empty.

Hmm... there is the possibly that this is a problem with my implementation, since it appears that SoundRecorder::OnProcessSamples is the only abstract function in the class and that SoundRecorder is the root of that portion of the class hierarchy.

I don't know how or why this error would occur, though, since I've provided an override for the function within my class. Given the contents of the error and the fact that it occurs during cleanup, it seems that destroying the object somehow results in the processing thread calling the abstract SoundRecorder::OnProcessSamples instead of my override - I'm never calling the function outside the processing thread.

I'll begin working on a test case within an hour or so. If I'm unable to make one I'll put my code up somewhere, as it's nothing sensitive (just a little bulky due to the FFT logic).

5
DotNet / Runtime error R6025 when using SoundRecorder in WinForms app
« on: April 01, 2015, 05:33:31 am »
I'm building a WinForms control which uses a SoundRecorder subclass to provide Fast Fourier Transform data to my application. When closing my test application an error window appears stating:
Quote
Microsoft Visual C++ Runtime Library
---------------------------------------------------
Runtime Error!
[filepath]
R6025
- pure virtual function call
The error is not caused by an exception that can be caught by managed C#.

Having researched this error a bit, I believe this might be caused by an issue with the destructor for SoundRecorder - I am too unfamiliar with the nuances of connecting managed C# to unmanaged C/C++ to say whether this is surely the case. I will be actively working on a more minimal example, hoping to post tomorrow if no one is able to solve this sooner.

6
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 24, 2015, 06:59:11 pm »
As expected, the problem was due to my noobishness with regard to OpenGL/GLSL. I'd assumed (in error) that texture coordinates being uploaded in pixels inferred that GLSL wouldn't follow the typical 0...1 standards for texture sampling. Kinda silly in retrospect. Output is a little stuttered, but I'm also using Intel HD Graphics on a three-year-old laptop, so whatevs.

zsbzsb and Laurent - I won't say my introduction to GLSL was painless by any means, but with your help it was at least palatable. Many thanks! :)

Sample output using exponential zoom, warping, color dampening, and a square for input is attached. Unfortunately I can't upload a video displaying how awesome this looks (re: Intel HD Graphics).

7
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 21, 2015, 07:20:05 pm »
Figured that was the case, since the documentation doesn't mention anything. Bummer! Doubt I have the OpenGL know-how to extend anything but the most simple portions of the SFML graphics library at present... For now I guess I'll just have a little extra trig in my shaders. Thanks Laurent.

8
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 21, 2015, 06:41:29 pm »
Out of curiosity: do SFML or SFML.NET possess any methods that allow 4-component (or multiple) texture vertices to be added to a VertexArray? It would be LOVELY if I could add polar coordinates to simplify a couple shader calculations I have planned.

9
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 21, 2015, 12:25:26 am »
Quote
You are forced to get the compiler-generated one, which sadly puts zeroes everywhere, which isn't suitable for all properties of RenderStates.

Ah, yeah, that makes sense. I imagine that'd end up trying to use a bunch of null pointers - not good.

We have results, though they're incorrect!

Must have messed up the shader somewhere, as it appears I've made a starfield generator. Working on it, but I am pretty rightly confused at this point... probably come back to it fresh in the morning. Feel free to peruse my code - tex coords mimic screen coords in all VertexArrays.

(click to show/hide)
(click to show/hide)
(click to show/hide)

10
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 20, 2015, 10:38:46 pm »
Mm, that seems to have fixed it, though the got-dang shader still isn't working.

I take it RenderStates' default constructor doesn't just default to the "normal" states? Have a couple C++ projects that need some code changes, in that case. Odd that I haven't run into this before.

11
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 20, 2015, 10:26:31 pm »
You say that like you could stop me, haha.

Might be a minute... currently getting no output from my self-implemented buffer (code below, if you're interested).

(click to show/hide)

12
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 20, 2015, 09:18:39 pm »
...and here I was hoping I'd found a gloriously simple loophole. I just KNEW this was gonna be trouble. I am now curious as to why RenderTexture.Display() is a thing. What's going on there?

Compositing on another texture should be fine (love that solution, btw, zsbzsb). Am I correct in assuming that when I call
target.draw(array, states)
'Shader.CurrentTexture' allows states.Shader to reference states.Texture?

EDIT: after further reading I think I've worked this out. It's not working yet, but I think I'm on the right track...

13
DotNet / Re: Fragment shader render-to-texture not working as expected
« on: March 20, 2015, 09:00:28 pm »
Perhaps I am missing the point of the function
m_Shader.SetParameter("texture", Shader.CurrentTexture);
then? I thought that could cause trouble, but it looked like RenderTextures were double buffered and I figured that'd take care of the obvious problems... It'd be easy enough to fix this with another texture for "buffering" the new render, I guess, though afaik the inability to do a deep copy could result in a fair amount of overhead. If it's not prohibitively difficult to explain why this is the case, I'd love to know.

14
DotNet / Fragment shader render-to-texture not working as expected
« on: March 20, 2015, 08:37:38 pm »
I am creating a program which uses the previously rendered frame to create an illusion of movement. In essence:
  • Objects are drawn on a RenderTexture
  • The RenderTexture is drawn to a RenderWindow using a full-screen quad
  • The RenderTexture is re-rendered to itself with a handful of shader effects
For those familiar with the WinAmp visualizer 'Milkdrop', this process should be relatively familiar... the outcome should be more or less identical.

For testing, I am drawing a square to the RenderTexture. The square renders just fine, but the shader effects don't seem to ever be applied... This is my first time working with GLSL within any SFML program (.NET or otherwise), so I'm likely missing something (and it's probably something stupid - apologies in advance). Code below:

(click to show/hide)

(click to show/hide)

15
DotNet / Re: Failure in Draw call in multithreaded WinForms app
« on: March 20, 2015, 07:51:01 pm »
Spent a good portion of yesterday creating a self-contained subset of the code, and accidentally ran across the solution to my problem. Last time I work off a version of CSFML I've compiled myself, I think *sigh*

Pages: [1] 2
anything