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

Pages: 1 ... 30 31 [32] 33 34
466
Audio / Audio classes crash program
« on: November 07, 2009, 12:33:24 am »
Quote from: "Axel"
so the program runs now but it cant load my mp3 file at all.
it doesnt load from the file or from memory.
ive tried it with 2 different files and got the same result.
when i try to load from the file it says "Failed to load '<mp3>' for reading"
and when i try from memory it says "Failed to load music from memory for reading"
MP3s require an expensive license to use, so SFML doesn't support MP3.

467
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 06, 2009, 12:47:11 am »
Quote from: "Laurent"
Quote
And it works, but I get blank spots on the sides of the screen

Can you show a screenshot? Have you tried to disable smoothing on your image?

Quote
and there is much lag

You didn't have it before?

Quote
Can you show a screenshot? Have you tried to disable smoothing on your image?
I just disabled smoothing, and the glitch changed slightly to this:

It also does get blackness on the top and bottom of the screen once every second, and when that happens, the darker area is on the sides.
Quote
You didn't have it before?
No, I did not. I emulated a Windows program using build 1245 or so with sf::PostFX, and it ran lag-free.
I ran a native Linux program using build 1262 with sf::Shader, and I'm getting piles of lag.

468
General discussions / Differences between PostFX and Shader
« on: November 05, 2009, 05:25:25 am »
Alright, so I got everything working with sf::Shader, and went to test the differences. Here's what I've found:
-Native Linux sf::Shader is very laggy
-Emulated Windows game with sf::PostFX runs perfectly at full speed
Why is it that an Emulated Game can run more efficiently than a Native Test? Here's another problem. When I used sf::PostFX, I used this shader:
Code: [Select]
texture screen
float time

effect
{
vec2 offset = vec2(cos(time/500+_in.x*10)/50, sin(time/500+_in.y*10)/50);
_out = vec4(screen(_in+offset));
}

This was meant to make a watery effect by stretching and shrinking the screen. It worked perfectly, every part of the screen was stretched and shrunk, and there were no blank spaces in the screen. I used this code:
Code: [Select]
#include <SFML/Graphics.hpp>
int main(){
 sf::RenderWindow Window(sf::VideoMode(512, 512, 32), "Test");
 sf::Image imgBackground;
 imgBackground.LoadFromFile("Random512x512image.png");
 sf::Sprite sprBackground;
 sprBackground.SetImage(imgBackground);
 sf::PostFX WaterShader;
 WaterShader.LoadFromFile("WaterShader.sfx");
 while (Window.IsOpened()){
  // Process Events here, close on sf::Event::Close
  Window.Clear();
  Water.SetTexture("screen", NULL);
  Water.SetParameter("time", (double)clock());
  Screen.Draw(sprBackground);
  Screen.Draw(Water);
  Screen.Display();
 }
}

It works like a charm. However, with sf::Shader, I translated the Shader file to this:
Code: [Select]
uniform sampler2D screen;
uniform float time;

void main(){
vec2 offset = vec2(cos(time/500+gl_TexCoord[0].x*10)/50, sin(time/500+gl_TexCoord[0].y*10)/50);
gl_FragColor = vec4(texture2D(screen, gl_TexCoord[0].xy+offset));
}

And the test's code to this:
Code: [Select]
#include <SFML/Graphics.hpp>
int main(){
 sf::RenderWindow Window(sf::VideoMode(512, 512, 32), "Test");
 sf::Image imgBackground;
 imgBackground.LoadFromFile("Random512x512image.png");
 sf::Sprite sprBackground;
 sprBackground.SetImage(imgBackground);
 sf::Shader WaterShader;
 WaterShader.LoadFromFile("WaterShader.sfx");
 while (Window.IsOpened()){
  // Process Events here, close on sf::Event::Close
  Window.Clear();
  Water.SetTexture("screen", sf::Shader::CurrentTexture);
  Water.SetParameter("time", (double)clock());
  Screen.Draw(sprBackground, Water);
  Screen.Display();
 }
}

And it works, but I get blank spots on the sides of the screen, and there is much lag. What could be causing this change?

469
Graphics / Sprites rendered approximately
« on: November 05, 2009, 02:52:23 am »
No, it's not even an issue. The problem is you didn't disable Image Smoothing.

470
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 05, 2009, 12:18:48 am »
Ignore this post, it was an error on my end.

471
Window / Strange behavior using sf::RenderWindow::SetFramerateLimit()
« on: November 05, 2009, 12:01:21 am »
Quote from: "panithadrum"
I am on Windows 7.
I set framelimit just after create my window. Here my code (nothing special):
Code: [Select]
///////////////////////
// Window
///////////////////////
// sf::RenderWindow
sf::RenderWindow sf_window;
// Set window name
{
std::stringstream name;
name << "The dead walk v" << GAME_VERSION_MAJOR << "." << GAME_VERSION_MINOR;
sf_window.Create(sf::VideoMode(320, 240, 16), name.str(), sf::Style::Close);
}
// Some properties
sf_window.UseVerticalSync(true);
sf_window.SetFramerateLimit(60);
sf_window.EnableKeyRepeat(false);

BTW, SetFramelimitRate works the same with/without VSync
please post a complete and minimal example showing the error.

472
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 04, 2009, 04:38:25 pm »
So I'm trying this out, right? I updated to build 1262, cded to the sfml2 directory, did a make sfml, then a sudo make install, changed my game to use the new shader class, compiled, and get this:
/usr/local/lib/libsfml-graphics.so  undefined reference to `sf::EnsureGlewInit()'

473
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 04, 2009, 04:09:32 am »
So we can draw the shader to specific sprites on the screen with Bind and Unbind? Exciting, now I can make my 2D Water distort everything inside of it. Before, it would've taken drawing the sprites, then after the water is drawn, copy that region covered by water to a sprite, render the shader to it, then copy that BACK to the screen.

474
Graphics / I fixed it
« on: November 02, 2009, 02:41:12 am »
Code: [Select]
////////////////////////////////////////////////////////////

/// Preprocess a SFML effect file

/// to convert it to a valid GLSL fragment shader

////////////////////////////////////////////////////////////

std::string PostFX::PreprocessEffect(std::istream& file)

{

    // Initialize output string

    std::string out = "";



    // Variable declarations

    std::string line;

    while (std::getline(file, line))

    {

        // Remove the ending '\r', if any

        if (!line.empty() && (line[line.size() - 1] == '\r'))

            line.erase(line.size() - 1);



        // Skip empty lines

        if (line == "")

            continue;



        out += line;

    }



    return out;

}

There's my temporary fix. It works. :D But it creates "stuttering", with a few frames drawing, then pausing, then a few frames drawing, then pausing.

475
Graphics / PostFX Segmentation Fault on Ubuntu 9.10
« on: November 01, 2009, 05:59:18 pm »
Quote from: "Laurent"
Did you try the post-fx sample from the SDK? Do you have any error message in the console?
I tried the PostFX Sample, it gives me a segmentation fault.

476
Graphics / PostFX Segmentation Fault on Ubuntu 9.10
« on: November 01, 2009, 05:56:58 am »
Ack, I am not liking Build 1250 so far.
Here's my code:
Code: [Select]
#include <SFML/Graphics.hpp>
#include <ctime>
int main(){
 sf::PostFX Water;
 sf::RenderWindow Window(sf::VideoMode(512, 512, 32), "Test");
 if (sf::PostFX::CanUsePostFX()){
  Water.LoadFromFile("Water.sfx");
  Water.SetTexture("screen", NULL);
  Water.SetParameter("time", (double)clock());
  Window.Draw(Water);
  Window.Display();
 }
}

Water.sfx:
Code: [Select]
texture screen
float time

effect
{
vec2 offset = vec2(cos(time/500+_in.x*10)/50, sin(time/500+_in.y*10)/50);
_out = vec4(screen(_in+offset));
}

The Window.Draw(Water) function is giving me a segmentation fault. I looked over the Shader, and it has nothing that could be causing this afaik. Did you remove the wrappers? This code worked in earlier builds. :\ Just to be sure it wasn't my code, I even tested with this Shader:
Code: [Select]
texture screen
float time

effect{
    _out = vec4(screen(_in));
}

Still get a segmentation fault.

477
Audio / Build 1250 gives error with loading Audio
« on: October 29, 2009, 11:30:36 pm »
Quote from: "Laurent"
Quote
I have always used globals with SFML, and they have always worked on Windows and Linux. Why would it stop working now?

Because I modified the initialization code internally.

Quote
I understand that SFML is not properly initialized, but how else am I going to use the BGMusic instance throughout my program(specifically the functions in Rooms.cpp)?

There are cleaner solutions to have objects globally available, without using global variables. If you have some time to spend thinking about it, I'm sure you can find a smarter design for managing these objects.

One more question: is "Failed to play audio stream..." the only message you get on the standard error output? There's nothing else before? Do you run your application in debug mode?
Failed to play Audio stream is the only error I am getting, since the program crashes immediately after.
I do have an idea for an alternative design, and I have been working on it, but it will take a while. It'll make my code a lot neater(and smaller), and should work...

478
Audio / Confused
« on: October 28, 2009, 03:38:16 pm »
Quote from: "Laurent"
You shouldn't use globals. Globals get constructed before main() starts, and SFML is not yet properly initialized at that point.
I need to use the sf::Music object throughout my entire project. In the actual program, it is defined in a file called Rooms.cpp, which does not contain main(), and the program works all the way up until I try to load the Music in Rooms.cpp. Everything else with SFML works, just not this music. I have always used globals with SFML, and they have always worked on Windows and Linux. Why would it stop working now? I understand that SFML is not properly initialized, but how else am I going to use the BGMusic instance throughout my program(specifically the functions in Rooms.cpp)?

479
Audio / The code
« on: October 28, 2009, 02:53:51 pm »
Quote from: "Laurent"
Can you show the code?

Is it build 1250 of trunk, or sfml2 branch?

Here is the piece of code that trys to load some Audio and fails:
Code: [Select]
#include <SFML/Audio.hpp>
sf::Music BGMusic;
int main(){
    if (BGMusic.GetStatus() != BGMusic.Playing){
        BGMusic.OpenFromFile("Title.ogg");
        BGMusic.SetLoop(false);
        BGMusic.Play();
    }
    while (BGMusic.GetStatus == BGMusic.Playing){
    }
}

The music can be found here.
It is the SFML2 Branch.

480
Audio / Build 1250 gives error with loading Audio
« on: October 28, 2009, 04:26:50 am »
I tried to run my game with Build 1250, and discovered something strange. When I try to load an Audio file, the console gives this error:
Failed to play audio stream : sound parameters have not been initialized (call Initialize first)
After that error is given, the program crashes. Does anyone have any ideas why this happens? I am on Ubuntu 9.04.

Pages: 1 ... 30 31 [32] 33 34