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

Pages: [1]
1
General / Re: Drawing 100 items per frame cuts FPS by 400?
« on: December 18, 2012, 02:07:28 pm »
He's talking about "delete pwindow;" at the end of main() even though the window wasn't allocated with new.

2
General / Re: Linker problem (only occurring with release)
« on: December 13, 2012, 08:38:28 am »
Quote
The settings shown here will result in your application being linked to the dynamic version of SFML, the one that needs the DLL files. If you want to get rid of these DLLs and have SFML directly integrated to your executable, you must link to the static version. Static SFML libraries have the "-s" suffix: "sfml-xxx-s-d.lib" for Debug, and "sfml-xxx-s.lib" for Release. In this case, you'll also need to define the SFML_STATIC macro in the preprocessor options of your project.
Tutorial - Getting started - SFML and Visual C++

3
Window / Re: sf::Window in my own class trow Errors
« on: November 28, 2012, 10:31:58 pm »
/////////////////////////////////////
#ifndef GLOBALS_H
#define GLOBALS_H
/////////////////////////////////////

#include "log.h"
#include "camera.h"
#include "window.h"

namespace Global{
        cLog log;
        cCam camera;
        cWindow window;
};
#endif
 

It seems like the global cWindow -- and it's internal sf::Window -- is created before SFML's global GlResource-mutex, so it crashes when trying to access it during the window's creation.

The solution would be to not create a global window like you're currently doing (since there's always a chance it'll be initialized before SFML).

Also, I believe creating it inside a header file like you're doing here would create a new window for each #include (and not one global shared one), so you should look into fixing that as well (either a totally new solution, hopefully fixing the previous problem as well, or declaring it as extern in the header and defining it in a .cpp-file).

4
System / Re: My Time is broken
« on: November 28, 2012, 05:03:38 am »
sf::Time just represents a given time-value, in your case the time as returned by Clock.getElapsedTime() before the while-loop. Try printing Clock.getElapsedTime(); inside the loop to see the current time incrementing.

5
General / Re: noob question: velocity
« on: November 24, 2012, 11:47:17 pm »
This seems like a somewhat strange/backwards way to go about it. The sprites don't move by themselves, so somewhere in you're code you know both where they were (since you moved them) and how much they moved from that place (again, since you moved them) -- and you could remember both these pieces of information.

In a platformer, you're usually controlling the velocity of objects (and moving them accordingly) -- not measuring it after the fact.

As you've discovered, only knowing the current position and the framerate (with no other information about how the movement happened) is insufficient to known the previous position.

6
Graphics / Re: CircleShape Disappearing
« on: November 24, 2012, 11:11:38 pm »
float xdiff = pos.x - v.x;
...
float newx = pos.x - (fabs(xdiff) * (1 / xdiff) * speed);
 
xdiff probably becomes zero when the circles converge, and newx subsequently explodes because of the division.
Why you don't get an exception I have no idea (assuming this is the problem).

Edit: Yes, this seems to be the case. Also, its seemingly common to not generate an exception on floating-point division by zero, but instead set it to a NaN-value. See this article and this FAQ for more information.

Finally, you could've probably found this out yourself with a little effort --- maybe printing the positions after each frame too see where they were. You'll usually get yelled at for simply posting a wall of code and expecting others to find the problem (or get no help), but I guess I was in a helping mood today. :P

7
Graphics / Re: Font .loadFromFile throwing a access violation.
« on: November 20, 2012, 05:21:10 pm »
Quote
CMake Error: The source directory "C:/Users/Travis/Desktop/SFML-2.0-rc" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

-_- Me and CMake never ever get along it seems.
I don't belive any of the other downloads contains the CMake-files, so you should try the newest snapshot.

8
Graphics / Re: Graphical artifacts in Windows 8 (with Radeon HD)
« on: November 17, 2012, 07:33:08 pm »
http://en.sfml-dev.org/forums/index.php?topic=9561.0

Much appreciated, thanks. Updated to 12.11 Beta and everything works as intended.
Yep, for me too.  Thanks for posting.
Great to see AMD not bothering to update it's buggy non-beta-drivers for nearly a month now. ::)

9
Graphics / Graphical artifacts in Windows 8 (with Radeon HD)
« on: November 17, 2012, 05:22:52 pm »
Hi,

I just installed Windows 8 and Visual Studio 2012 and am having some problems with SFML 2.0.
In my actual application there's quite a lot of weird graphical artifacts, but I noticed there was a problem with text specifically, so I created a minimal example (from the SFML pong-example code actually) showing it:

#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML Pong");

    // Load the text font
    sf::Font font;
    if (!font.loadFromFile("resources/sansation.ttf"))
        return EXIT_FAILURE;

    // Initialize the pause message
    sf::Text pauseMessage;
    pauseMessage.setFont(font);
    pauseMessage.setPosition(20, 20);
    pauseMessage.setColor(sf::Color::White);
    pauseMessage.setString("Welcome to SFML pong!");

    while (window.isOpen())
    {
        // Handle events
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Window closed or escape key pressed: exit
            if ((event.type == sf::Event::Closed) ||
               ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)))
            {
                window.close();
                break;
            }
                }

        // Clear the window
        window.clear(sf::Color(50, 200, 50));

                sf::RectangleShape r(sf::Vector2f(10,10));
                r.setPosition(10,10);
                window.draw(r);
                window.draw(r); // Comment out to fix text
                window.draw(pauseMessage);

        // Display things on screen
        window.display();
    }

    return EXIT_SUCCESS;
}

With the second call to draw the RectangleShape commented out, I get this as expected:


But commenting it in yields this:


I've tried a few things to troubleshoot this:
- It does not matter if I'm drawing the same object twice, or two different ones.
- Calling draw on the text again (with another colour or in another location so it doesn't blend in) shows correctly.
- The colour of the rectangle does not matter -- the "text-boxes" are the text's colour.
- Looking at draw(...) in RenderTarget and what it calls, I can't see any state that could've been kept by SFML between drawing the rectangle and text.

This leaves me thinking there must be some error in the graphics driver which doesn't operate OpenGL's state-machine correctly so the state from drawing the second rectangle somehow persists to the next draw call. To further test this, I tried running an old build of my application built by VS2010 in Windows 7 (where it worked fine) and it also shows artifacts there. Other OpenGL-applications works fine though (tested Quake 3 and an OpenGL 3.3-application (i.e. not fixed function pipeline)).

Any suggestions what I could do? Seeing as other OpenGL-applications work fine, I'm 1) not entirely confident it's a problem with OpenGL, and 2) even if it is it seems like a very localized problem so there's probably little hope for a fix any time soon.

I have a Radeon HD6950 and am running the latest driver (Catalyst 12.10).

Edit: Oh, and BTW, this is with the newest snapshot of SFML 2.0 (044eb858). I also tested one from around the start of May since that seems to be when the RC was built (as the working-in-Win7-but-not-Win8-VS2010-build used it) . Same problem.

Pages: [1]
anything