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

Pages: [1] 2
1
Audio / accessing soundrecorder-data while recording
« on: July 19, 2011, 05:56:52 pm »
Hi,

we want to implement a "voicekey" in software, i.e. a sound activated relay.
Therefore, we need to 'listen' online to the sound data while recording.
Is it possible to read the data recorded with the sound recorder while
recording? Aim: measuring the time from start recording until a specific
sound pressure level is exeeded.

Thanks in advance - Sven

BTW: we are still with sfml 1.4 (never change a running system in
experimental psychology)

2
Graphics / dummy question on sf::Image::CopyScreen
« on: November 26, 2008, 11:12:30 pm »
Hi,

no, it's not a performance issue. For the experiment at hand I simply need mirror-images from letters. Now I could prepare these letters with some graphics software, save them as images to file and load them with sfml. This requires some work especially when I decide to use a different set of letters, or digits or want to change the image size without loss of quality or want to use a different font. Thus, it is easier to render the text with sfml. Since FlipX and FlipY are not available for sfml strings I need a workaround to create the mirror images. With the help of CopyScreen (and having in mind the coordinate issue) this workaround is available now. Fine.

Thanks - Sven

3
Graphics / dummy question on sf::Image::CopyScreen
« on: November 26, 2008, 10:07:11 pm »
Thanks a lot! Great.

Now I can easily flip.x and flip.y strings, just draw the string on screen,
CopyScreen the string to an Image, make it a sprite and flip the sprite.
You made my day.

Thanx again.

-Sven-

4
Graphics / dummy question on sf::Image::CopyScreen
« on: November 26, 2008, 04:18:15 pm »
Quote from: "Laurent"
Quote
works if and only if (x2-x1) <= 1024. Otherwise, SaveToFile crashes.

1024 must be the maximum texture size supported by your graphics card ;)

Quote
And the saved files are distorted unless the image-width is a power of 2, e.g. x2-x1 = 64 = 2^6 results in a correct saved image (besides y-flipping), image width of 63 or 65 pixel gives strange results, image width of 128 is okay and so on...

Can you upload an example of such a distorted image ?


Okay, max texture size... I c :-)

Now to the relevant images. On screen everything is fine. The following images are the saved ones.

129 x 128 px:


128 x 128 px: that's visible on the screen


127 x 128 px:


126 x 128 px:


Another example:

127 x 110 px:


128 x 110 px: that's on the screen




Looks somehow systematic to me ;-)

Yours - Sven

5
Graphics / dummy question on sf::Image::CopyScreen
« on: November 26, 2008, 03:21:56 pm »
Quote from: "Laurent"
Ok, two things :
- I fixed the crash happening after a call to SaveToFile
- CopyScreen actually works, except that the source image is flipped vertically; that's why you don't see your B.

I'll definitely have to find a good solution (not just workarounds) for this flipped coordinates issue, as it impacts multiple parts of the code.


Hi Laurent,

thanks a lot for your help. I verified that CopyScreen works and LoadFromFile no longer crashes after a call to SaveToFile.

Unfortunately, I found some other problems...

Code: [Select]
Image1.CopyScreen( Screen, sf::IntRect(x1, y1, x2, y2) ) ;
Image1.SaveToFile( "test1.jpg" ) ;


works if and only if (x2-x1) <= 1024. Otherwise, SaveToFile crashes.

And the saved files are distorted unless the image-width is a power of 2, e.g. x2-x1 = 64 = 2^6 results in a correct saved image (besides y-flipping), image width of 63 or 65 pixel gives strange results, image width of 128 is okay and so on...

HTH - Sven (thanx again for your invaluable help)

6
Graphics / dummy question on sf::Image::CopyScreen
« on: November 21, 2008, 09:13:27 pm »
Hi Laurent,

I did a bit more testing...

Code: [Select]

sf::String Letter("B", Arial100, 100) ;
sf::Image Image1, Image2 ;
sf::Sprite Sprite1, Sprite2;

Letter.SetPosition( 0, 0 ) ;
Screen.Draw( Letter) ;
Screen.Display() ;
Image1.CopyScreen( Screen, sf::IntRect(0, 0, 100, 100) ) ; // does not the copy
Image2.LoadFromFile( "testimage.bmp" ) ; // runs okay due to your fix on image loading and creation - thanks again


But:

Code: [Select]

sf::String Letter("B", Arial100, 100) ;
sf::Image Image1, Image2 ;
sf::Sprite Sprite1, Sprite2;

Letter.SetPosition( 0, 0 ) ;
Screen.Draw( Letter) ;
Screen.Display() ;
Image1.CopyScreen( Screen, sf::IntRect(0, 0, 100, 100) ) ; // does not the copy, but results in funny stripes
Image1.SaveToFile( "test.bmp" ) ; // saves the funny stripes to disk
Image2.LoadFromFile( "testimage.bmp" ) ; // crashes Windows XP


That means: a LoadFromFile is pretty okay,  but a previous SaveToFile causes LoadFromFile to crash Windows. Only a hard reset reanimates Windows. The crash results in a pixel mess at the top of the display.

-Sven-

7
Graphics / dummy question on sf::Image::CopyScreen
« on: November 21, 2008, 05:44:44 pm »
Hi,

I inserted a Screen.Display() before CopyScreen, this did not change anything. The saved image looks like this:


-Sven-

8
Graphics / dummy question on sf::Image::CopyScreen
« on: November 21, 2008, 04:56:01 pm »
Just did a SaveToFile().

Interestingly, the image/sprite is no longer empty but shows a
nice stripe pattern ;-)

BTW: SaveToFile() saves in what format? IrfanView accepts it as *.bmp...

ciao - Sven

9
Graphics / dummy question on sf::Image::CopyScreen
« on: November 21, 2008, 04:19:09 pm »
Hi,

after discovering sf::Image::CopyScreen I thought I could draw some text on the screen, invoke Image::CopyScreen to copy the relevant part of the screen to an image and after that to set a corresponding sprite.

Code: [Select]

sf::String Letter("B", Arial100, 100) ;
sf::Image Image1 ;
sf::Sprite Sprite1;

Letter.SetPosition( 0, 0 ) ;
Screen.Draw( Letter) ;
Image1.CopyScreen( Screen, sf::IntRect(0, 0, 100, 100) ) ;
Sprite1.SetImage( Image1 );


But this results in an 'empty' image/sprite. Thus, something must be wrong with my thinking Image::CopyScreen works.

Please, can someone enlighten me :-)

Thanx - Sven

10
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 21, 2008, 01:47:26 pm »
Yes. Yes. Yes.

I tried some image loading and image creating and it runs
perfect. I tested it on two different machines which have had
the problems. I will do some more testing but I'm pretty sure
all is okay.

AND:

This weired font-load-problem
 http://www.sfml-dev.org/forum/viewtopic.php?t=704
is gone, too.

Thanx for all the help.
-Sven-

11
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 17, 2008, 01:59:52 pm »
Quote from: "zarka"
umm see the thread 2 posts down perhaps ?...

http://www.sfml-dev.org/forum/viewtopic.php?t=726


Probably not, because
- I receive no error message 'can't load font'
- I have no ASCII-sequence in the command window

-Sven-

12
Graphics / svn: Image.LoadFromFile and Image.Create crashes
« on: November 17, 2008, 11:32:36 am »
Hi...

Code: [Select]
sf::Image Image1 ;
Image1.Create( 100, 100, sf::Color::Blue ) ;


crashes with 0xC0000005. This holds true for several different computers running Windows XP SP2 or SP3. On _some_ pretty new machines the code runs without error.

If I create a really small image, say Create( 10, 10,...) the program doesn't crash but the image is garbage (random pixels in the image area).

The same behavior can be seen with Image.LoadFromFile():

Code: [Select]
sf::Image Image1 ;
Image1.LoadFromFile("mypic.bmp") ;


crashes on some machines, on others a garbage picture is displayed, on very new computers it works.

This whole thing seems similar to the svn: font problem
http://www.sfml-dev.org/forum/viewtopic.php?t=704

Since the created or loaded images are garbage, maybe a memory allocation problem, same could be the reason for crashes on font load.

ciao - Sven

13
Graphics / FlipX and FlipY for sfml strings
« on: November 16, 2008, 09:06:39 pm »
Would you be so kind as to post your code. Thanx.

-Sven-

14
Graphics / FlipX and FlipY for sfml strings
« on: November 16, 2008, 12:33:15 pm »
Quote from: "bullno1"
Can a negative scale do the trick?


Documentation says for SetScaleX() values must be strictly positive and I tried a negative value: no effect.

-Sven-

15
Graphics / FlipX and FlipY for sfml strings
« on: November 15, 2008, 12:44:30 pm »
Quote from: "Laurent"
In what situation would you need to display flipped text ? :D


I'm not a game programmer but I want to use sfml for programming cognitive psychology experiments. For one line of research rotated single characters are displayed 'normal' or as mirror images and subjects were to decide as fast as possible whether the characters are normal or mirror images. Thus, I need to flip the characters to produce mirror images.

Yours - Sven

Pages: [1] 2
anything