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 - 51423benam

Pages: [1] 2
1
Graphics / Re: SFML Drawing Hierarchies
« on: December 26, 2018, 05:41:10 pm »
Hello,

well, why not just use absolute coordinates (which you have to) but hide it as much as possible? For example, if you construct the child widget:

Widget* child = new ChildWidget (myCoordinates + relativeCoordinates);

You could also implement a move () function, which you pass relative coordinates to, and then, if your parent widget gets moved, you just call move() with the exact same vector.

2
Graphics / UI performance and VertexArrays
« on: December 26, 2018, 05:34:03 pm »
Hello,
I use SFML to render my GUI, meaning that I implement the widgets, containers, event handlers etc. myself.
I have many Widgets of different types in the Software, and because of that, I am worried about the drawing performance.

Every widget holds a vector of it's components (sf::Drawable derivatives). For the example, buttons consist of rounded rectangles (custom shapes) which is textured, an outline, a sf::Text, and so on. It gets way more complicated with more complex composit widgets. All that would result in a very high number of draw calls.

Now, I read in the docs that it's especially slow to change the current texture (I think it's because of the underlying openGL bind () or whatever), so I think I can speed things up by drawing all the buttons with the same texture first.
Are there any further accelerations I should be aware of?
I read something about the sf:: Vertexarray, but I don't know how that would help me, because it seems like it's only for groups of primitives like tiles.
Thanks in advance

3
Audio / custom soundstream onGetData() quits being called after a few calls
« on: September 01, 2018, 02:05:49 pm »
Hello,

I did a thread already about that, but the thread was inactive a few weeks, I got some additional info and I wanted to make a fresh restart. So: I am implementing a custom soundstream. The problem is that onGetData() only gets called 3 or 4 times, although I continue to provide data and I don't quit the stream anyhow. I noticed that sometimes the data (samples) I deliver in the last onGetData() call that happens before not making calls anymore, consists completely of the value 255. But that happens only like half of the runs. Here is my code: https://ufile.io/vvyuw (It's a codeblocks project, but you can see the code anyways). Do you know what could be the problem?

4
Audio / Re: Soundstream onGetData() is called only once
« on: August 09, 2018, 04:34:58 pm »
The problem still exists, but this time I don't get any message of the debugger of an error / segfault. Everything seems to work, but onGetData is only called like 3 or 4 times.

5
General / Building SFML for Codelite with Clang on Windows
« on: July 21, 2018, 05:18:52 pm »
Hello,

I want to build SFML to use it in Codelite, with the compiler clang on Windows 10. I downloaded the sources, but when I want to configure cmake, I can't find Codelite clang in the exporter list. Is that important? Do the exporter and the use environment have to match up completely?
Thanks!

6
Audio / Re: Soundstream onGetData() is called only once
« on: June 19, 2018, 10:41:47 pm »
Ok, maybe I know why. I get an exception in a funtion onGetData calls (a segfault). I try to reproduce it simple, but that's not easy... what would be the expected behaviour of a soundstream when there is a exception? Does is just cancel playback?

7
Audio / Soundstream onGetData() is called only once
« on: June 18, 2018, 03:50:36 pm »
Hey guys,

I wrote a custom Soundstream-derived class which is steered from outside. The problem is, I am cout-ing "ONGETDATA HAS BEEN CALLED" every time it is called, but in the main program is only outputs it once. Do you know a reason for that? My onGetData function gets it data from another class called AudioManager. And now, you might ask, if it has data and so on, but I am already checking that. In ongetData(), I am also cout-ing the sum of every buffer (which ligns up with the expected) and of course, returning true to continue playing. I connected it to a class which reads a file and pushes the buffers through a connection to the AudioManager.
I made sure it works, also, the sum of the buffers in the in- and output is the same, so the connection is not a problem either. The program just exits after about 2.5 seconds (although the file lasts 5 seconds) and onGetData() is called only once. Do you know a possible reason for the whole thing?

Btw: I know you want to have code  ;), but it is split across several files which is likely meaningless for you.

8
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 19, 2018, 12:27:14 am »
Oh, I think, I had some missing steps to link sfml correctly, it seems like I didn't read the getting started article well enough, I will check that again.

9
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 18, 2018, 08:02:43 pm »
I downloaded the latest mingw-get-installer.exe from the official website and installed the base mingw, the c++ compiler and msys basis.
But since the example soundstream code worked, it has to be my code that is false somehow, right?

10
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 18, 2018, 05:54:54 pm »
My full code in this class is:
AudioManager.h:
#ifndef AUDIOMANAGER_H_INCLUDED
#define AUDIOMANAGER_H_INCLUDED

#include <memory>
#include <vector>

#include <SFML/Audio.hpp>

#include "utils.h"
#include "../nodes/outputNode.h"

class AudioManager;

class customAudioStream : public sf::SoundStream{

public:

private:
    virtual bool onGetData(Chunk& data);
    virtual void onSeek(sf::Time timeOffset);
    void registerAudioManager(AudioManager* audioManager);

    AudioManager* manager;
};

class AudioManager{
public:

    AudioManager();
    ~AudioManager();
    void registerOutputNode(std::unique_ptr<outputNode> newOutNode);
    std::vector<sf::Int16>* getOutputAudio();

private:
    std::unique_ptr<outputNode> outNode;
    customAudioStream stream;
};


#endif // AUDIOMANAGER_H_INCLUDED
 

AudioManager.cpp:
#include "AudioManager.h"

bool customAudioStream::onGetData(Chunk& data){
    return true;
}

void customAudioStream::onSeek(sf::Time timeOffset){

}


void customAudioStream::registerAudioManager(AudioManager* audioManager){
    manager = audioManager;
}

AudioManager::AudioManager(){

}

AudioManager::~AudioManager(){

}

void AudioManager::registerOutputNode(std::unique_ptr<outputNode> newOutputNode){
    outNode = std::move(newOutputNode);
}

std::vector<sf::Int16>* AudioManager::getOutputAudio(){
    std::vector<sf::Int16>* output;
    output->reserve(size);
    DataBlock* data;
    data = outNode->getAudioData();
    std::vector<boost::variant<sf::Int16, int>>* rawData = data->getData();
    for(int counter = 0; counter < rawData->size(); counter++){
        (*output)[counter] = boost::get<sf::Int16>((*rawData)[counter]);
    }
    return output;
}
 

11
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 18, 2018, 05:52:34 pm »
It is set to full command line. No, I didn't download the compiler with the links, but it matches, both with the version number and the compiler type (it's dw2). Also, I just copied the example from the tutorial page into a .h file and it didn't throw errors in that file, so it has to be something related to my code.

12
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 18, 2018, 04:37:25 pm »
I downloaded sfml for gcc 7.3.0 and installed mingw 7.3.0.
However, I still have errors, here they are:

||=== Build: Debug in SFML_CodeBlocks_TEST (compiler: GNU GCC Compiler) ===|
obj\Debug\src\AudioManager.o||In function `ZN17customAudioStreamC1Ev':|
D:\SFML_CodeBlocks_TEST\SFML_CodeBlocks_TEST\include\AudioManager.h|14|undefined reference to `_imp___ZN2sf11SoundStreamC2Ev'|
obj\Debug\src\AudioManager.o||In function `ZNKSt14default_deleteI10outputNodeEclEPS0_':|
d:\mingw\7.3.0\lib\gcc\mingw32\6.3.0\include\c++\bits\unique_ptr.h|76|undefined reference to `outputNode::~outputNode()'|
obj\Debug\src\AudioManager.o:AudioManager.cpp:(.rdata$_ZTV17customAudioStream[__ZTV17customAudioStream]+0x10)||undefined reference to `sf::SoundStream::play()'|
obj\Debug\src\AudioManager.o:AudioManager.cpp:(.rdata$_ZTV17customAudioStream[__ZTV17customAudioStream]+0x14)||undefined reference to `sf::SoundStream::pause()'|
obj\Debug\src\AudioManager.o:AudioManager.cpp:(.rdata$_ZTV17customAudioStream[__ZTV17customAudioStream]+0x18)||undefined reference to `sf::SoundStream::stop()'|
obj\Debug\src\AudioManager.o:AudioManager.cpp:(.rdata$_ZTV17customAudioStream[__ZTV17customAudioStream]+0x1c)||undefined reference to `sf::SoundStream::getStatus() const'|
obj\Debug\src\AudioManager.o:AudioManager.cpp:(.rdata$_ZTV17customAudioStream[__ZTV17customAudioStream]+0x28)||undefined reference to `sf::SoundStream::onLoop()'|
obj\Debug\src\AudioManager.o||In function `ZN17customAudioStreamD1Ev':|
D:\SFML_CodeBlocks_TEST\SFML_CodeBlocks_TEST\include\AudioManager.h|14|undefined reference to `_imp___ZN2sf11SoundStreamD2Ev'|
||error: ld returned 1 exit status|
||=== Build failed: 9 error(s), 2 warning(s) (0 minute(s), 35 second(s)) ===|

I don't know what's wrong. Maybe I have the wrong sfml subversion (you know, that dw2, sjlj stuff). Is there a way to check for which subversion my sfml version is?

13
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 17, 2018, 07:33:37 am »
So if I understand you right, I don't have to compile with the compiler I use then for my sfml project and it work anyway?

14
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 16, 2018, 08:36:31 pm »
http://www.codeblocks.org/downloads/binaries
That's the link where you can find the mingw nosetup.zip. But thanks, I will look into that links.

15
Audio / Re: undefined reference to _imp___ZN2sf11SoundStreamC2Ev
« on: May 16, 2018, 03:13:54 pm »
I just noticed that the sfml version I downloaded doesn't match up exactly (I have gcc 6.3.0, the sfml version is for 6.3.0). But in general, I have a problem. The latest sfml version is only available for gcc version 7.3.0. The problem is, I don't have admin rights I would need to install the latest mingw. The mingw I have was included in the codeblocks mingw nonadmin setup. Is there a workaround for this?

Pages: [1] 2
anything