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

Pages: [1] 2 3 4
1
General / Compiling SFML from source, CMake problems
« on: September 30, 2013, 06:20:58 am »
So I am trying to compile SFML 2.1 from the source, and I am having some issues with CMake.

I did my best to follow the tutorial to the letter, but when I hit Configure in the CMake window, I get the following errors I don't understand:

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:C:/Users/Guerric/Downloads/SFML Custom/CMakeFiles/2.8.11.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:C:/Users/Guerric/Downloads/SFML Custom/CMakeFiles/2.8.11.2/CMakeCXXCompiler.cmake
Configuring incomplete, errors occurred!

I used the
set PATH=%PATH%;your_mingw_folder\bin
command to set the PATH variable (obviously with my own installation directory), and tried running CMake both from the desktop icon and from the command prompt using cmake-gui.

How can I solve these and get to compiling SFML?

2
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 30, 2013, 02:33:52 am »
Well, I am definitely up for building SFML from the source if that solves my issues.  I've downloaded the source already; I suppose I'll read this and see what I can make of it.  I'll post again when I do and say whether I've had any luck.

Also, I hadn't been removing my CodeBlocks settings from AppData/Roaming previously, but doing so after uninstalling it doesn't seem to help either.

3
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 30, 2013, 01:59:52 am »
So I was browsing MinGW/bin and discovered that the folder contains both libgcc_s_sjlj-1 and libgcc_s_dw2-1 DLLs (the install straight from the CB website).  If I delete libgcc_s_dw2-1, the compiler tells me that the program can't start because libgcc_s_dw2-1 isn't on my computer. 

So clearly the compiler is in fact trying to compile according to DW2 rather than SJLJ, but I can't figure out why or how to change it.  This is the third time I install CodeBlocks and MinGW directly from the provided package today after wiping out the old install (I think), and that should be SJLJ, which is what TDM uses, right?

4
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 30, 2013, 12:51:18 am »
I installed the compiler you linked to and set that as my compiler in CB's compiler settings, yet I still get the exact same error.  Perhaps there is some other way to set the compiler settings I am not aware of...

UPDATE: I also tried using your nightly build TDM 4.7.1 32-bit instead of the version from the main site, and I tried compiling with the CodeBlocks-standard 4.7.1 as well as the 4.8.1, in all combinations, but they all generate that error.  And just to be safe I deleted my SFML files and re-downloaded the GCC 4.7 TDM (SJLJ) - 32 bits version, again.  None of that changed anything.

Perhaps I will try installing on another PC tomorrow.

5
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 30, 2013, 12:39:14 am »
I actually found a thread that suggested the error might be related to SJLJ/DW2 on StackOverflow, so I deleted my old SFML install (not remembering which it was) and was quite careful to download the TMD build, 32-bits, and not the DW2 build - still the same problem.

Also, I "upgraded" by uninstalling my old CodeBlocks install and then installing the new one which, according to the site, comes packaged with TDM-GCC (version 4.7.1, 32 bit).  It's possible something was leftover from a previous installation, but when I uninstalled CodeBlocks everything in the CodeBlocks folder, which was where MinGW was installed, was removed, and I checked my compiler settings and found that it was indeed pointing to CodeBlocks/MinGW/ for the compiler directory, so it shouldn't be grabbing anything else.

I will follow your suggestion and upgrade to the 4.8.1 version, and see if that helps.

6
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 29, 2013, 11:44:18 pm »
I also tried a brand new, non-SFML project, and it worked fine; afterwards I integrated the simple example found here, and got the same error about a procedure entry.

7
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 29, 2013, 11:32:46 pm »
Ah, of course, that's important - yes, I am linking the -d files in Debug and the other files in Release.

Also, the compiler I use is the one that comes standard with CodeBlocks 12.11 - MinGW 4.7.1.

Just for kicks I uninstalled Codeblocks, reinstalled it and set up my linkages again, and tried building the window example that comes bundled with SFML 2.1.  The result is the following error, apparently at link-time:

The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll.

I checked, and I do have libstdc++-6.dll in MinGW's bin folder; I also tried copying it into the project folder, to no avail.

When I upgraded to MinGW 4.7.1, the very first problem I had was that it was telling me that I was using an unrecognized command line option "-static-libstdc++", and after asking around I was told that I didn't need to manually link since MinGW 4.7.1 statically links libstdc++ by default.  Might that have something to do with it?

8
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 29, 2013, 10:55:15 pm »
I am using the version of SFML 2.1 labelled GCC 4.7 TDM (SJLJ) - 32 bits, which I am linking to in my compiler settings.  I didn't build it from the source code.

I also tried with the older version I had, SFML 2.0 RC, but that didn't work either.

I don't appear to be mixing debug and release, if by that you mean having linked the libraries under only one of the options but building in the other option.

9
General / Re: static sf::Font initialization crashes program in MinGW4.7.1
« on: September 29, 2013, 09:40:36 pm »
Okay, so I just spent a while refactoring my code to get rid of crashing static variables, but now something even stranger is happening.  When I try to initialize an sf::VideoMode in main(), for use in the sf::RenderWindow I declare on the next line, that initialization crashes the program.

This occurs even if I remove everything else from the program, so that my main.cpp file looks like this:
#include <SFML/Graphics.hpp>

int main()
{
    sf::VideoMode GameMode = sf::VideoMode(800, 600, 32);
    return 0;
}

My debugger has only this to say:

#0 691C4AF9     sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int) () (C:\Users\Guerric\Desktop\CREATI~1\GAMEEN~1\sfml-window-2.dll:??)
#1 0042C3F7     main() (C:\Users\Guerric\Desktop\Creative Works\Game Engine - Anthill\main.cpp:27)

I'm stumped.  Is it possible that there are some issues with SFML 2.0 and the 4.7.1 version of MinGW?

10
General / static sf::Font initialization crashes program in MinGW4.7.1
« on: September 29, 2013, 06:45:56 pm »
So I recently upgraded to MinGW 4.7.1 and, lo and behold, it broke my program.

The debugger suggests that the culprit is a static sf::Font object I initialize in my Interface class (from Interface.cpp):

sf::Font Interface::m_Font;

The debugger says:

#0 669815E2     sf::Font::Font() () (C:\Users\Guerric\Desktop\CREATI~1\GAME-D~1\sfml-graphics-2.dll:??)
#1 0040521E     __static_initialization_and_destruction_0(__initialize_p=1, __priority=65535) (C:\Users\Guerric\Desktop\Creative Works\Game - Digitesque Prison\Interface.cpp:11)
#2 00405272     _GLOBAL__sub_I__ZN9Interface5m_AppE() (C:\Users\Guerric\Desktop\Creative Works\Game - Digitesque Prison\Interface.cpp:263)
#3 0042719A     __do_global_ctors () (??:??)
#4 004010DC     __mingw_CRTStartup () (??:??)
#5 00401295     mainCRTStartup () (??:??)

Any ideas on what is going wrong here?

11
So I have a Sprite, which itself has a Texture, and which may be scaled/rotated/translated.  I should probably also note that it is centered, i.e.

Sprite.setOrigin(Sprite.getLocalBounds().width / 2, Sprite.getLocalBounds().height / 2);

I also have a given Point (sf::Vector2f) in global space.

If the point is within the Sprite's local bounds, I want to figure out the color of the exact pixel of the source Texture the point corresponds to.

Obviously I somehow need to convert from global to local space, but I'm not sure how to do this.  My previous attempt was:

//I also tried without subtracting the position,
//since I assume that the sprite's translation is also included in its transform
Point.x -= Sprite.getPosition().x;
Point.y -= Sprite.getPosition().y;

//I also tried getTransform(), which unsurprisingly didn't work either
Point = Sprite.getInverseTransform().transformPoint(Point);

sf::Color PointColor = Sprite.getTexture()->copyToImage().getPixel(Point.x, Point.y);

What is the correct way of doing this?

12
Audio / Re: Modifying length of a sound sample?
« on: June 29, 2013, 01:59:13 am »
@Hiura

D'oh!  Of course you're right.  I was making all those samples and not putting them in the array.  :o

Now it works.  Thanks!

13
Audio / Re: Modifying length of a sound sample?
« on: June 28, 2013, 11:51:37 pm »
Ah, okay, so something more like this?

//Create a note from code
sf::Int16 Samples[44100];
//Frequency, in herz
for (int sample = 0; sample < 44100; ++sample)
{
    //This is essentially the value of X
    double Position = (double)sample / 44100.0;
    sf::Int16 Sample = 32767 * sin(262 * Position * 2 * PI);
}

CodeNote.loadFromSamples(Samples, 44100, 1, 44100);

This still gives me scratchy stuff, though it is different-sounding scratchy stuff. 

14
Audio / Re: Modifying length of a sound sample?
« on: June 28, 2013, 09:08:00 pm »
Thanks for the extra information!  This might come in handy.

In getting the basics down pat, though, I'm having some trouble.  I'm trying to figure out the basic construction of a decent sample array, and I'm getting scratchy sounds.  Here is what I have right now, trying to obtain a 1-second sound:

//For storing the samples
sf::Int16 Samples[44100];

//I want 44100 samples, since I want 44100 per second and one second of sound
for (int sample = 0; sample < 44100; ++sample)
{
    //This is essentially the time into the sound
    double Position = (double)sample / 44100.0;

    //Frequency of the curve is 262 Hz
    sf::Int16 Sample = sin(262*Position);
}

sf::SoundBugger CodeNote;
CodeNote.loadFromSamples(Samples, 44100, 1, 44100);

Given the scratchy, glitchy-sounding result, that's clearly not quite what I should be doing.  What am I misunderstanding?

15
Audio / Re: Modifying length of a sound sample?
« on: June 25, 2013, 03:54:21 pm »
That's an interesting suggestion.  I assume I would be making use of sf::SoundBuffer::loadFromSamples(), after creating my own array of samples, right?

I suppose I'll have to read up about the structure of audio samples, but this may be even better than using sample files.  Is there anything special I should know about the structure of the sample array to be fed into the SoundBuffer?

Pages: [1] 2 3 4
anything