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

Pages: 1 [2] 3
16
Audio / Delayed playing.
« on: June 25, 2009, 12:43:19 pm »
Ok, I uploaded a little quick'n'dirty demo program: http://www.itak.de/share/audioplay.rar

So what I do there is:

- Load the sound in a SFML SoundBuffer and create a sound object
- Load the sound in a byte array and create a .NET Audio Device
- Start two threads, one for SFML one for .NET Audio Device
- Wait for the threads to synchronize
- Start both players
- Should result in a single "beep", but I hear a "bebeep" (--> one is delayed)

But uhm, now that I benchmarked it that way I just found out that the delay more or less is just a few msec (< ~30msec). So it should not matter and SFML should be working correct. I must have messed up something with the original code were I thought it would be delayed much more...
I guess you can close the topic Laurent. Seems it was a false report. Sorry for that.

17
Audio / Delayed playing.
« on: June 25, 2009, 10:18:05 am »
I dont really know how SFML loads the sounds, but if it loads the sounds when I create a Soundbuffer-instance then it was loaded. And I ran the test in a loop so after the first run it should be loaded, right?

18
Audio / Delayed playing.
« on: June 25, 2009, 01:34:05 am »
I use SFML 1.5 (latest SVN) with .NET. I experienced a small delay after calling SOUND.Play().

Ok, lets check this:

Code: [Select]

        Dim boomBuf As New SoundBuffer("hq_boom.wav")
        Dim somesound As New Sound(boomBuf))

        With New Microsoft.VisualBasic.Devices.Audio
            somesound.Play()
            .Play(ByteArrayThatConatainsTheAudioFile, AudioPlayMode.Background)
        End With


What it does is basically load a sound into a buffer and create a sound object.
Then it instanciates a new .NET-Audio Device and then starts playing with both objects (the default .NET player and the SFML Sound).

The sound file I load is just a WAV with a single short "beep".

If both sounds would start playing right after another (like it should be) one would more or less just hear a "bebeep". But what you hear is "beep"...(delay ~300 to 500msec)..."beep".

The SFML sound is delayed. I realized this when I was making a simple application (Press key -> play sound). One could really "hear" the delay, it is pretty much too long for...let's say a game with a rocket exploding or something.

So, anyone got an idea about this? I saw someone posted something similar a few weeks ago but that problem got fixed back then, so this can / should not be related to this.

I just tried if it got fixed in SFML2-branch...but no, same think. Playing starts slightly delayed. =(

Edit: The order I start the sounds playing doesnt matter (first .NET-Player then SFML-Sound = same like first SFML then .NET). There is always a delay.

19
Graphics / PostFX Problem...
« on: June 23, 2009, 03:08:41 pm »
Ah thanks! I found out that my notebook's GFX chip only supports 22 instructions. I guess that might be the problem.

For those who ever might have the same problem:
I worked around the problem by applying 2 effects then. One blurring horizontally, another one blurring vertically. Halfes the performance, but it's still ok for my purposes.

Topic can be closed.

20
Graphics / PostFX Problem...
« on: June 23, 2009, 11:56:36 am »
Hm....what kind of tool do you mean? Could you give me a hint about what to google for? I have to admit that i am not that deep into shaders, so i really dont have a clue about what hitword could match my needs.

21
Graphics / PostFX Problem...
« on: June 23, 2009, 11:37:36 am »
I tried to make a new blur effect. Well, first, here is my code:

Code: [Select]

texture framebuffer

effect
{
float x = _in.x;
float y = _in.y;

float zx = 1.0 / 640.0;
float zy = 1.0 / 480.0;

vec4 p1 = framebuffer(vec2(_in.x, _in.y));
vec4 p2 = framebuffer(vec2(_in.x + zx, _in.y + zy));
vec4 p3 = framebuffer(vec2(_in.x - zx, _in.y + zy));
vec4 p4 = framebuffer(vec2(_in.x + zx, _in.y - zy));
vec4 p5 = framebuffer(vec2(_in.x - zx, _in.y - zy));

_out = (p1 + p2 + p3 + p4 + p5) * 0.2;
}



What I do is basically just get the vec4s of the colors that are a bit right, left, above or below the current pixel and just sum them up and multiply them by a factor to keep the brightness.

But the problem is: This example only works for me as long as I replace the last line (   _out = (p1 + p2 + p3 + p4 + p5) * f;) by this line:

   _out = (p1 + p2 + p3) * f;

As you can see I can not sum up all 5 vectors...It keeps crashing. As soon as I add more then 3 (no matter which ones I add, it just have to be less then 4) the effect simply doesn't show and the App.Window doesnt update anymore (oh and CPU usage goes up to 100%). If i just ad 3 vectors: everything works fine... Does anyone know what I am doing wrong?

EDIT: Strange enough, but this works too:

_out = p1 + p1 + p1 + p1 + p2 + p2 + p2;

So, the error occures as soon as I want to sum up more then 3 different vectors. A work around like

vec4 dummy = p1 + p2 + p3;
_out = dummy + p4 + p5;

doesnt work, too...

Another EDIT:

I thoguht it might be a memory problem with the GLSL compiler or something so i tried this code:

Code: [Select]

texture framebuffer

effect
{
float x = _in.x;
float y = _in.y;

float zx = 1.0 / 640.0;
float zy = 1.0 / 480.0;

vec4 val;
vec4 p1 = framebuffer(vec2(_in.x, _in.y));

val = framebuffer(vec2(_in.x + zx, _in.y + zy));
p1 = p1 + val;

val = framebuffer(vec2(_in.x - zx, _in.y + zy));
p1 = p1 + val;

val = framebuffer(vec2(_in.x + zx, _in.y - zy));
p1 = p1 + val;

val = framebuffer(vec2(_in.x - zx, _in.y - zy));
p1 = p1 + val;

float f = 0.2;

_out = p1 * f;
}


Problem remains: As soon as i sum up more then 3 different pixels i get a crash. If i just add 3 or less all is fine....

22
SFML projects / SPARK opensource particle engine with an SFML module
« on: June 22, 2009, 08:54:24 pm »
Quite nice! Will you offer .NET bindings for SPARK+SFML, too?

23
General discussions / Release interval
« on: May 25, 2009, 01:48:56 pm »
I guess downloading the SVN and compiling it is more or less the same...

24
General discussions / ludum dare mini compo May 22
« on: May 22, 2009, 01:03:25 pm »
hehe. good luck! Tell us when you are done with your project there =)

25
Window / RenderWindow returning 0 width/height after creation (Win)
« on: May 22, 2009, 01:00:31 pm »
I am using .GetWidth/.GetHeigh with latest SVN (SFML2) and it works like it should.

26
General / Just a question about the progress
« on: May 22, 2009, 12:50:57 pm »
Quote

I don't know if in Visual Basic you can just let it alive, but in C++ I just never free it and I'm doing OK.

Hm, I think there is no way to keep it alive since .NET destroys it automatically i guess.

Quote

I've already posted that if the library skips the wglDeleteContext in the WM_DESTROY event... SFML wont crash.

I will comment out those lines and recompile SFML and see what happens.

But isnt it strange that deactivating the VS.NET's debug host process fixes the crashes too...?

27
General / Just a question about the progress
« on: May 19, 2009, 09:02:57 pm »
Quote from: "Laurent"
Quote
but seems it doesnt work for the .NET package

Yes, in SFML.Net the internal sf::String of the String2D class is always constructed with the default font first.

Quote
I compiled the .NET libs i found here: /branches/sfml2/dotnet/
I tried my little testprogram again...still same error. =(

You have to recompile SFML (static release), CSFML (dynamic release) and then SFML.Net.


Ok, i recompiled it like you said i should. Then i copied the new files (csfml-???.dll) to dotnet/extlibs/ and recompiled the dotnet-projekt. Then i copied all new libs (csfml-???.dll and fsmlnet-???.dll) to my test project and set up the links correctly. the problem got partly solved:

running the executable out of the IDE (VS2008, Debugging mode) --> error on exit
running the executable (release-build, not out of IDE) --> no error on exit
running the executable (debug-build, but not out of IDE) --> no error on exit

I figured out that the error is still caused by the string2D class. As long as i dont create that class, i wont get an error. but maybe it's just an IDE issue? Any ideas anyone?

edit: Disabeling the VS-Host-Process fixes the error, too...

28
General / Just a question about the progress
« on: May 19, 2009, 12:30:20 pm »
Hm, yes, i read i should avoid the default font and it should work ... but seems it doesnt work for the .NET package (at least it doesnt for me.... O.O)
But i will try to use the SFML2 branch. It's this one, right? /branches/sfml2/dotnet/

Oh, just in case i am doing something wrong, here is the quick'n'dirty code i used for testing the crashing:

Code: [Select]

Imports SFML.Graphics
Imports SFML.Audio
Imports SFML.Window
Imports System

Module Module1
    Dim WithEvents App As RenderWindow
    Dim doit As Boolean = True

    Public Sub Main()
        Dim vMode As New VideoMode(640, 480, 32)
        App = New RenderWindow(vMode, "Test", Styles.None Or Styles.Titlebar)

        Dim img As New Image("somefile.png")
        Dim sprite As New Sprite(img)

        Dim fnt As Font = New Font("c:\windows\fonts\Calibri.ttf", 14)
        Dim str2D As New String2D("Hello World", fnt, 14)

        Dim ff As Long = 0
        Dim st As Long = Now.TimeOfDay.TotalMilliseconds
        Dim fps As Single = 0

        App.UseVerticalSync(True)
        App.SetFramerateLimit(60)

        While App.IsOpened And doIt

            App.Clear(New SFML.Graphics.Color(0, 0, 0, 1))
           
            sprite.Position = New Vector2(sprite.Position.X + 1, 10)
            If sprite.Position.X > 600 Then sprite.Position = New Vector2(0, 10)
            sprite.BlendMode = BlendMode.Alpha
            App.Draw(sprite)

            sprite.Position = New Vector2(sprite.Position.X + 1, 100)
            sprite.BlendMode = BlendMode.Multiply
            App.Draw(sprite)

            ff += 1
            If Now.TimeOfDay.TotalMilliseconds - st >= 1000 Then
                fps = (ff / (Now.TimeOfDay.TotalMilliseconds - st) * 1000)

                'str2D.Dispose()      'Even if this line is commented out I get the crash.
                'str2D = New String2D(fps, fnt, 14)

                st = Now.TimeOfDay.TotalMilliseconds : ff = 0
            End If

            'App.Draw(str2D)        'No need to draw it...crash occures anyways.
            App.Display()
            App.DispatchEvents()
        End While

        str2D.Dispose()
        fnt.Dispose()
        fnt = Nothing
        str2D = Nothing
        App.Close
    End Sub

    Private Sub App_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles App.Closed
        doit = False
        'App.Close() '<- no need here. Releaseing Resources in Sub Main...
    End Sub

    Private Sub App_KeyPressed(ByVal sender As Object, ByVal e As SFML.Window.KeyEventArgs) Handles App.KeyPressed
        doit = False
        'App.Close() '<- no need here. Releaseing Resources in Sub Main...
    End Sub
End Module


Edit:
I compiled the .NET libs i found here: /branches/sfml2/dotnet/
I tried my little testprogram again...still same error. =(
Maybe someone can tell me what I am doing wrong? I uploaded everything I used for testing (Test-Project and the latestet SFML2 dotnet-library): http://www.itak.de/share/SFMLTest.rar

29
General / Just a question about the progress
« on: May 19, 2009, 12:26:54 am »
Hello.

I will start a new projekt next month and we are thinking about switching from SDL to SFML. As mentioned in several topics and in the todo-list there is a major issue with SFML crashing when the main program closes and you used drawtext (or however it's called...) before.
I myself would prefer to use SFML for that projekt but i wonder if that bug will be fixed during the next few days / weeks. I checked the todo-list and found out that the last edit was on 06 March =(. So, my question is if there is a chance that this bug will get fixed "soon" or if there is a work around for that crashing issue...
Does anyone know?

30
DotNet / Change RenderWindow's Title after creation...
« on: May 17, 2009, 09:38:23 pm »
Yup, then maybe consider this as a feature request...

Pages: 1 [2] 3
anything