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 ... 29 30 [31] 32 33 34
451
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 17, 2009, 03:41:13 am »
Got it to work by changing the RenderImage to an Image and CopyScreen() instead of the RenderImage functions.

452
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 15, 2009, 07:22:32 pm »
Quote from: "l0calh05t"
You do know that you are only drawing once?
Yes. I don't change what the screen shows after I draw.

453
Graphics / Freeing a sprite from memory
« on: November 15, 2009, 04:18:51 am »
You should use a vector of pointers to Missiles, then push_back(new missile Missile(constructorarguments));
When you exit the game, make a piece of code that iterates through the vector, deleting each Missile as you go, and then clear the vector at the end with vector.clear(). You can also create a function for this that you can run at any time to clear it out.

454
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 15, 2009, 02:55:39 am »
Code: [Select]
#include <SFML/Graphics.hpp>

int main(){
    sf::RenderWindow Window;
    Window.Create(sf::VideoMode(512, 512, 32), "Test");
    sf::Image Background;
    Background.LoadFromFile("Any512x512Image.png");
    sf::Sprite BG(Background);
    //sf::RenderImage Screen; // Uncomment this line and comment the definition ahead and Flush if you want to test both
    if (sf::Shader::IsAvailable()){
        sf::RenderImage Screen;
        Screen.Draw(BG);
        Screen.Display();
        Window.Draw(sf::Sprite(Screen.GetImage()));
        Window.Flush();
    }
    else
        Window.Draw(BG);
    Window.Display();
    sf::Event Event;
    while (Window.IsOpened()){
        while (Window.GetEvent(Event)){
            if (Event.Type == sf::Event::Closed)
                Window.Close();
            if (Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape)
                Window.Close();
        }
    }
    return EXIT_SUCCESS;
}

There's the code that does not work for me. It draws nothing.

455
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 14, 2009, 02:10:32 am »
Quote
Quote
Guess what? I just get a white screen. Why is this? When I replace the Window.Draw line with Window.Draw(BG); it works fine. When I use this code, it absolutely fails. What am I doing wrong? I'm drawing the BG to the RenderImage, Displaying the RenderImage, then drawing the RenderImage to the Screen, and I get White. :S

Your RenderImage instance gets destroyed after the call to Draw; but SFML delays the actual drawing until you call Window.Display(), and at this time the source image doesn't exist anymore.
Moved the sf::RenderImage's Declaration to outside the if statement, in the context of the Window.Display() code. Black screen. Moved it back inside and added a Window.Flush() to the end of the if statement. Black Screen.

456
General discussions / dukghasfgdsg Multiple Shader Fail
« on: November 13, 2009, 04:12:42 am »
So I am trying to make the screen draw two shaders, right? Here's the shader code in the Title Screen in Main.cpp of my repository(not committed yet):
Code: [Select]
       if (sf::Shader::IsAvailable()){
            Water.SetTexture("screen", sf::Shader::CurrentTexture);
            Water.SetParameter("time", Clock.GetElapsedTime()*1000.f);
            Blend.SetTexture("screen", sf::Shader::CurrentTexture);
            Blend.SetParameter("color", 0.5, 0.0, 0.5);
            Blend.SetParameter("alpha", 1.0);
            sf::RenderImage Screen;
            Screen.Draw(BG);
            Screen.Display();
            Window.Draw(sf::Sprite(Screen.GetImage()));
        }

Guess what? I just get a white screen. Why is this? When I replace the Window.Draw line with Window.Draw(BG); it works fine. When I use this code, it absolutely fails. What am I doing wrong? I'm drawing the BG to the RenderImage, Displaying the RenderImage, then drawing the RenderImage to the Screen, and I get White. :S

457
Graphics / Gray line when drawing an sprite
« on: November 13, 2009, 01:29:03 am »
Quote from: "Laurent"
Quote
Hmm I thought I was using SFML2.0, but I think it's 1.6 (I'm using the SVN trunk version).

Ok. This bug has been fixed in SFML 2.

Quote
My graphics card doesn't even have a name... It is an integrated one.

Ok, so the 10 FPS might just be your computer :)
However, one or two other users reported bad performances on Windows 7, and I still haven't found why.
I haven't had any performance troubles on Windows 7. Have those other people updated their drivers?

458
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 13, 2009, 01:26:35 am »
Quote from: "Laurent"
Quote
Here's our repository: http://mke.svn.sourceforge.net/viewvc/mke/
I tried to Shader sample, and it works fine, so I dunno what's going on.

It seems like clock() has a very low resolution on Linux. Using a sf::Clock solves the problem.
Alright then. Thanks for the help! I switched to sf::Clock and it works perfect!

On the shader sample, global fisheye Y coordinates are flipped for me. It doesn't do this with background, and I can't tell on flower.

459
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 12, 2009, 06:24:38 am »
Quote from: "Laurent"
Quote
I updated to SFML 1268, and the glitch with the tearing and blackness is gone, but I still have the lag.
Here's the demo with SFML 1268.
http://willhostforfood.com/access.php?fileid=93440
Use run.sh to use the local .so files.

I couldn't use the local .so files (my system has a problem and needs a modified version of SFML), but I tried shaders with the latest revision:
- the Shader sample runs perfectly
- I can see the lag in your application

Can you show your source code? Did you try the Shader sample?
Here's our repository: http://mke.svn.sourceforge.net/viewvc/mke/
I tried to Shader sample, and it works fine, so I dunno what's going on.

460
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 11, 2009, 11:10:30 pm »
Quote from: "Laurent"
Quote from: "OniLink10"
float edge = sqrt(hEdge.rgb * hEdge.rgb + vEdge.rgb * vEdge.rgb);
That's some good coding right there.

?
The sqrt returns a vec3, since the value sent to it is a vec3. vec3s cannot be assigned to floats.

461
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 11, 2009, 10:34:11 pm »
Hello!
float edge = sqrt(hEdge.rgb * hEdge.rgb + vEdge.rgb * vEdge.rgb);
That's some good coding right there.

462
General / display Chinese characters ???
« on: November 07, 2009, 08:45:31 pm »
Quote from: "Ceylo"
Quote from: "OniLink10"
Don't define variables in headers, it's not safe nor sane.

Class members... ?
That would work, but he is not using class members, he is just defining the variables.

463
General / display Chinese characters ???
« on: November 07, 2009, 04:54:22 am »
Soo, what is your problem?

Don't define variables in headers, it's not safe nor sane.

464
General / Question about game structure
« on: November 07, 2009, 03:00:08 am »
Usually they are structured by "rooms", where you use a single variable to tell which room it is, and then choose the room function to run based on that. At least, that's how I (used to) do it.

465
General discussions / New Shader class in SFML 2 to replace PostFx
« on: November 07, 2009, 01:51:24 am »
I updated to SFML 1268, and the glitch with the tearing and blackness is gone, but I still have the lag.
Here's the demo with SFML 1268.
http://willhostforfood.com/access.php?fileid=93440
Use run.sh to use the local .so files.

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