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.


Topics - Lolilolight

Pages: 1 2 [3] 4
31
Graphics / Shaders are not binded to my render textures!
« on: April 16, 2014, 06:32:21 pm »
Hi!

I would like to render things on components, the components uses a depth buffer texture, a framebuffer texture, a view and a shader for advanced alpha and depthtesting.

But, there is a problem, it seems that my shaders are not binded because it doesn't do the alpha test and the depthtest :

#include "../../../../include/odfaeg/Graphics/2D/fastRenderComponent.h"
namespace odfaeg {
namespace g2d {
FastRenderComponent::FastRenderComponent (RenderWindow& window, int layer) :
    Transformable(Vec3f(window.getView().getPosition().x, window.getView().getPosition().y, layer),
                  Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0),
                  Vec3f(window.getView().getSize().x + window.getView().getSize().x * 0.5f, window.getView().getPosition().y + window.getView().getSize().y * 0.5f, layer)),
    view(window.getView()) {
    sf::Vector3i resolution ((int) window.getSize().x, (int) window.getSize().y, window.getView().getSize().z);
    depthBuffer = new RenderTexture();
    frameBuffer = new RenderTexture();
    depthBuffer->create(resolution.x, resolution.y);
    frameBuffer->create(resolution.x, resolution.y);
    frameBuffer->setView(window.getView());
    depthBuffer->setView(window.getView());

    if (Shader::isAvailable()) {
        frameBufferGenerator = new Shader();
        depthBufferGenerator = new Shader();
        const std::string vertexShader =
        "void main () {"
            "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
            "gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;"
            "gl_FrontColor = gl_Color;"
        "}";
        const std::string  depthGenFragShader =
        "uniform sampler2D depthBuffer;"
        "uniform sampler2D texture;"
        "uniform vec3 resolution;"
        "void main () {"
              "vec2 position = ( gl_FragCoord.xy / resolution.xy );"
              "vec4 color = texture2D(depthBuffer, position);"
              "vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);"
              "if (abs(gl_FragCoord.z) > color.z && pixel.a >= color.a) {"
                 "gl_FragColor = vec4(0, 0, abs(gl_FragCoord.z), pixel.a);"
              "} else {"
                 "gl_FragColor = color;"
              "}"
        "}";
        const std::string frameBufferGenFragShader =
        "uniform sampler2D depthBuffer;"
        "uniform sampler2D frameBuffer;"
        "uniform sampler2D texture;"
        "uniform vec3 resolution;"
        "void main () { "
            "vec2 position = ( gl_FragCoord.xy / resolution.xy );"
            "vec4 depth = texture2D(depthBuffer, position);"
            "vec4 color = texture2D(frameBuffer, position);"
            "vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);"
            "if (abs(gl_FragCoord.z) >= depth.z) {"
                "gl_FragColor = pixel;"
            "} else if (color.a < pixel.a) {"
                "gl_FragColor = pixel;"
            "} else {"
                "gl_FragColor = color;"
            "}"
        "}";
        if (!depthBufferGenerator->loadFromMemory(vertexShader, depthGenFragShader))
            throw Erreur(50, "Failed to load depth buffer generator shader", 0);
        if (!frameBufferGenerator->loadFromMemory(vertexShader, frameBufferGenFragShader))
            throw Erreur(51, "Failed to load frame buffer generator shader", 0);
         depthBufferGenerator->setParameter("resolution",resolution.x, resolution.y, resolution.z);
         frameBufferGenerator->setParameter("resolution",resolution.x, resolution.y, resolution.z);
         backgroundColor = sf::Color::Transparent;
    }
}
void FastRenderComponent::setBackgroundColor(sf::Color color) {
    this->backgroundColor = color;
}
void FastRenderComponent::clearBufferBits() {
    frameBuffer->clear(backgroundColor);
}
void FastRenderComponent::clearDepthBits() {
    depthBuffer->clear(sf::Color::Transparent);
}
g2d::Tile FastRenderComponent::getFrameBufferTile () const {
    sf::IntRect subRect(0, 0, frameBuffer->getView().getSize().x, frameBuffer->getView().getSize().y);
    g2d::Tile tile (&frameBuffer->getTexture(), Vec2f(0, 0), Vec2f(frameBuffer->getView().getSize().x, frameBuffer->getView().getSize().y), subRect);
    return tile;
}
g2d::Tile FastRenderComponent::getDepthBufferTile() {
    sf::IntRect subRect(0, 0, depthBuffer->getView().getSize().x, depthBuffer->getView().getSize().y);
    g2d::Tile tile (&depthBuffer->getTexture(), Vec2f(0, 0), Vec2f(depthBuffer->getView().getSize().x, depthBuffer->getView().getSize().y), subRect);
    return tile;
}
bool FastRenderComponent::load(std::vector<Entity*> visibleEntities)
{

    if (Shader::isAvailable()) {
        fg.clear();
        for (unsigned int i = 0; i < visibleEntities.size(); i++) {

            if (visibleEntities[i]->isLeaf()) {
                for (unsigned int j = 0; j < visibleEntities[i]->getFaces().size(); j++) {

                    visibleEntities[i]->getFaces()[j]->transform(visibleEntities[i]->getTransform());

                    fg.addFace(visibleEntities[i]->getFaces()[j]);
                }
            }
        }
        m_vertices = fg.getFaces();
    }
    this->visibleEntities = visibleEntities;
}

void FastRenderComponent::draw(RenderTarget& target, RenderStates states) const {
    const Shader* devShader = states.shader;
    states.transform = getTransform();
    if (Shader::isAvailable()) {
        states.shader = frameBufferGenerator;
        frameBufferGenerator->setParameter("depthBuffer", depthBuffer->getTexture());
        frameBufferGenerator->setParameter("frameBuffer", frameBuffer->getTexture());
        frameBufferGenerator->setParameter("texture", Shader::CurrentTexture);
        frameBuffer->setView(target.getView());
        for (unsigned int i = 0; i < m_vertices.size(); i++) {
            states.texture = const_cast<FastRenderComponent*>(this)->m_vertices[i].first.getMaterial().getTexture();
            for (unsigned int j = 0; j < m_vertices[i].second.size(); j++) {
                frameBuffer->draw(*m_vertices[i].second[j], states);
            }
        }
        frameBuffer->display();
        depthBuffer->setView(target.getView());
        depthBufferGenerator->setParameter("depthBuffer", depthBuffer->getTexture());
        depthBufferGenerator->setParameter("texture", Shader::CurrentTexture);
        states.shader = depthBufferGenerator;
        for (unsigned int i = 0; i < m_vertices.size(); i++) {
            states.texture = const_cast<FastRenderComponent*>(this)->m_vertices[i].first.getMaterial().getTexture();
            for (unsigned int j = 0; j < m_vertices[i].second.size(); j++) {
                depthBuffer->draw(*m_vertices[i].second[j], states);
            }
        }
        depthBuffer->display();
        g2d::Tile tile = getFrameBufferTile();
        tile.setCenter(frameBuffer->getView().getPosition());
        states.shader = devShader;
        target.draw(tile, states);
    } else {
        for (unsigned int i = 0; i < visibleEntities.size(); i++) {
            for (unsigned int j = 0; j < visibleEntities[i]->getFaces().size(); j++) {
                states.texture = visibleEntities[i]->getFaces()[j]->getMaterial().getTexture();
                states.transform = visibleEntities[i]->getTransform();
                target.draw(visibleEntities[i]->getFaces()[j]->getVertexArray(), states);
            }
        }
    }
}
void FastRenderComponent::init() {
}
FastRenderComponent::~FastRenderComponent() {

}
View& FastRenderComponent::getView() {
    return view;
}
int FastRenderComponent::getLayer() {
    return getPosition().z;
}
}
}
 

I pass the shader to the state before drawing on the framebuffer and the depthbuffer but it doesn't seems to work. :/

But when I draw directly on the renderwindow it works...

32
General / Opengl : the vbo doen't build correctly.
« on: April 07, 2014, 04:49:24 pm »
Hi, I'm trying to make a class to build vbo, but it doesn't work, the size of the data passed is not good : (it's 4 instead of 12 so it draw nothing)

void VBO::create (const void* data, const unsigned int dataSize) {
    ensureGlContext();
    if (m_vbo == 0) {
        GLuint vbo;
        glCheck(glGenBuffers(1, &vbo));
        m_vbo = static_cast<unsigned int>(vbo);

    }

    if (isAvailable() && m_vbo != 0 ) {
        glCheck(glBindBuffer(GL_ARRAY_BUFFER, m_vbo));
        glCheck(glBufferDataARB(GL_ARRAY_BUFFER_ARB,dataSize, data, GL_DYNAMIC_DRAW));
        glCheck(glBindBuffer(GL_ARRAY_BUFFER, 0));
    } else {
        std::cerr<<"Failed to create the vbo, you should check if vbo are avalaible first! (by calling the VBO::isAvailable function)"<<std::endl;
    }
}
 

const_cast<VertexArray*>(this)->vboVertex.create(&m_vertices[0], m_vertices.size() * sizeof(Vertex));
 

Anyone have any idea about how I have to pass data to my create function ?

And I'm searching for a good opengl forum to get some help. :P

33
Graphics / The RenderTexture deform my sprites.
« on: April 07, 2014, 11:02:18 am »
Hi, I've two source codes : once with draw sprites on a render window, and the other with draw sprites on a render texture and then draw this rendertexture on the renderwindow, but, when I draw my sprites on the render texture, they are deformed :

Here is the code and a screenshot of the two different results :
(First : it draws normally)

#include <SFML/Graphics.hpp>
#include "fastRenderComponentManager.h"
using namespace sf;
std::vector<sf::Sprite> generate_map(Texture& text, IntRect rect) {
    int startX = rect.left / 100 * 100;
    int startY = rect.top / 50 * 50;
    int endX = (rect.left + rect.width) / 100 * 100;
    int endY = (rect.top + rect.height) / 50 * 50;
    std::vector<sf::Sprite> ground;  
    for (int x = startX; x <= endX; x+=100) {
        for (int y = startY; y <= endY;  y+=50) {          
            Vector2f pos(x, y);        
            Sprite sprite (text);
            sprite.setPosition(pos);
            ground.push_back(sprite);
        }
    }
    return ground;
}
int main()
{
    // création de la fenêtre
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
    sf::Texture text;
    text.loadFromFile("tilesets/herbe.png");
    std::vector<Sprite> ground = generate_map(text,IntRect(0, 0, 1000, 1000));
    // on fait tourner le programme tant que la fenêtre n'a pas été fermée
    while (window.isOpen())
    {
        // on traite tous les évènements de la fenêtre qui ont été générés depuis la dernière itération de la boucle
        sf::Event event;
        while (window.pollEvent(event))
        {
            // fermeture de la fenêtre lorsque l'utilisateur le souhaite
            if (event.type == sf::Event::Closed)
                window.close();
        }

        // effacement de la fenêtre en noir
        window.clear(sf::Color::Black);
        // c'est ici qu'on dessine tout
        for (unsigned int i = 0; i < ground.size(); i++)
            window.draw(ground[i]);

        // fin de la frame courante, affichage de tout ce qu'on a dessiné
        window.display();
    }

    return 0;
}
 

http://img15.hostingpics.net/pics/695819result1.jpg

And here's the second source code which give me a different result :

#include "fastRenderComponentManager.h"
#include <iostream>
using namespace sf;
FastRenderComponentManager::FastRenderComponentManager(RenderWindow& window) : window (window) {
}
void FastRenderComponentManager::clearBufferBits(sf::Color color) {
    clrColor = color;
    frameBuffer->clear(color);
}
Sprite FastRenderComponentManager::getFrameBufferTile () const {
    Sprite sprite (frameBuffer->getTexture());
    return sprite;
}
void FastRenderComponentManager::draw(Drawable& drawable, RenderStates states) const {  
    frameBuffer->setView(window.getView());
    frameBuffer->draw(drawable, states);
    frameBuffer->display();  
    Sprite sprite = getFrameBufferTile();
    window.draw(sprite);
}
FastRenderComponentManager::~FastRenderComponentManager() {
    delete frameBuffer;
    delete depthBuffer;
    delete depthBufferGenerator;
    delete frameBufferGenerator;
}
 
#include <SFML/Graphics.hpp>
#include "fastRenderComponentManager.h"
using namespace sf;
std::vector<sf::Sprite> generate_map(Texture& text, IntRect rect) {
    int startX = rect.left / 100 * 100;
    int startY = rect.top / 50 * 50;
    int endX = (rect.left + rect.width) / 100 * 100;
    int endY = (rect.top + rect.height) / 50 * 50;
    std::vector<sf::Sprite> ground;
    //Positions de départ et d'arrivées en fonction de la taille, de la position et de la taille des cellules de la map.
    for (int x = startX; x <= endX; x+=100) {
        for (int y = startY; y <= endY;  y+=50) {
            //On projete les positions en fonction de la projection du jeux.
            Vector2f pos(x, y);
            //Mur du coin en haut à gauche.
            Sprite sprite (text);
            sprite.setPosition(pos);
            ground.push_back(sprite);
        }
    }
    return ground;
}
int main()
{
    // création de la fenêtre
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
    sf::Texture text;
    text.loadFromFile("tilesets/herbe.png");
    std::vector<Sprite> ground = generate_map(text,IntRect(0, 0, 1000, 1000));
    FastRenderComponentManager componentManager(window);
    // on fait tourner le programme tant que la fenêtre n'a pas été fermée
    while (window.isOpen())
    {
        // on traite tous les évènements de la fenêtre qui ont été générés depuis la dernière itération de la boucle
        sf::Event event;
        while (window.pollEvent(event))
        {
            // fermeture de la fenêtre lorsque l'utilisateur le souhaite
            if (event.type == sf::Event::Closed)
                window.close();
        }

        // effacement de la fenêtre en noir
        window.clear(sf::Color::Black);
        componentManager.clearBufferBits(sf::Color::Transparent);
        // c'est ici qu'on dessine tout
        for (unsigned int i = 0; i < ground.size(); i++)
            componentManager.draw(ground[i]);

        // fin de la frame courante, affichage de tout ce qu'on a dessiné
        window.display();
    }

    return 0;
}
 
http://img15.hostingpics.net/pics/868542result2.jpg

My sprites are scaled on y...

34
Hi, opengl always display those error messages when I compile a library using SFML in debug mode and when I use render textures and shaders :

An internal OpenGL call failed in Texture.c++(497) : GL_INVALID_VALUE, a numeric argument is out of range.

I've the same error message for this location : shader.cpp (469)

But when I compile in release mode, the error message disappears.





35
General / Error (invert a 4*4 matrix)
« on: April 05, 2014, 09:38:31 pm »
Hi, I've a problem with this source code and I don't see where :
Matrix4f Matrix4f::inverse () throw (std::exception&) {
    Matrix4f store;
    float fa1 = m11 * m22 - m12 * m21;
    float fa2 = m11 * m23 - m13 * m21;
    float fa3 = m11 * m24 - m14 * m21;
    float fa4 = m12 * m23 - m13 * m22;
    float fa5 = m12 * m24 - m14 * m22;
    float fa6 = m13 * m24 - m14 * m23;
    float fb1 = m31 * m42 - m32 * m41;
    float fb2 = m31 * m43 - m33 * m41;
    float fb3 = m31 * m44 - m34 * m41;
    float fb4 = m32 * m43 - m33 * m42;
    float fb5 = m32 * m44 - m34 * m42;
    float fb6 = m33 * m44 - m34 * m43;
    float det = fa1 * fb6 - fa2 * fb5 + fa3 * fb4 + fa4 * fb3 - fa5 * fb2 + fa6 * fb1;
    if (Math::abs(det) <= 0.f) {
        return store;
    } else {
       store.m11 = m22 * fb6  - m23 * fb5 + m24 * fb4;
       store.m21 = -m21 * fb6  + m23 * fb3 - m24 * fb2;
       store.m31 = m21 * fb5  - m22 * fb3 + m24 * fb1;
       store.m41 = -m21 * fb4  + m22 * fb2 - m23 * fb1;

       store.m12 = -m12 * fb6  + m13 * fb5 - m14 * fb4;
       store.m22 = m11 * fb6  - m13 * fb3 + m14 * fb2;
       store.m32 = -m11 * fb5  + m12 * fb3 - m14 * fb1;
       store.m42 = m11 * fb4  - m12 * fb2 + m13 * fb1;

       store.m13 = m42 * fa6  - m43 * fa5 + m44 * fa4;
       store.m23 = -m41 * fa6  + m43 * fa3 - m44 * fa2;
       store.m33 = m41 * fa5  - m42 * fa3 + m44 * fa1;
       store.m43 = -m41 * fa4  + m42 * fa2 - m43 * fa1;

       store.m14 = -m32 * fa6  + m33 * fa5 - m34 * fa4;
       store.m24 = m31 * fa6  - m33 * fa3 + m34 * fa2;
       store.m34 = -m31 * fa5  + m32 * fa3 - m34 * fa1;
       store.m44 = m31 * fa4  - m32 * fa2 + m33 * fa1;

       float invDet = 1.f / det;
       return store * invDet;
    }
}
 

This source code is the same than the source code of jme except that I start at 1 and not 0 for the row and column numbers.

Mmm I don't think to use a framework is a good idea, often there are untested, and, there are errors in the source code.

But it's good to have a good code design.

This source code don't provide me the same result, it print me 1, 1, 11 as result and it should be 1, 1, 1 if I cancel the transform.
TransformMatrix tm;
    Vec3f p(1, 1, 1);
    //tm.setScale(Vec3f(2.f, 2.f, 2.f));
    tm.setTranslation(Vec3f(20, 10, 10));
    //tm.setRotation(Vec3f(0, 0, 1), 10);
    Vec3f pt = tm.transform(p);

    std::cout<<tm.get3DMatrix() * tm.get3DMatrix().inverse()<<std::endl;
    std::cout<<tm.inverseTransform(pt)<<std::endl;
 

Does everyone have a function with work ?

36
Graphics / Just a question.
« on: April 03, 2014, 09:08:12 pm »
I've a question, why you pretransform vertices only when their size is 4 or less ?


37
Hi!

There is something that I really don't understand.

I'm putting all static leaf visible entities of a scene node into a std::vector, this work well.

And then, I copy this vector into another vector and I insert dynamic visible entities in this other vector, here's the to last function (the one which copy the 2D vector to a 1D vector and the other which insert dynamic visible entities into the 1D vector)

vector<Entity*> Map::getVisibleEntities (std::string type) {
    View view = window->getView();
    Vec3f position (view.getPosition().x - view.getSize().x * 0.5f, view.getPosition().y - view.getSize().y * 0.5f, 0);
    Vec3f size (view.getSize().x, view.getSize().y, 0);
    lightMap->setView(view);
    shadowMap->setView(view);
    std::vector<Entity*> shadowEntities;
    std::vector<Entity*> lightEntities;
    sf::Color ambientColor = AmbientLight::getAmbientLight()->getColor();
    lightMap->clear(ambientColor);
    std::vector<Entity*> entities;
    if (type.at(0) == '*') {
        VEntitiesTypeByZ it;
        if (type.find("-") != string::npos)
            type = type.substr(2, type.size() - 2);
        vector<string> excl = split(type, "-");
        for (unsigned int l = 0; l < gridMap->getNbLayers(); l++) {
            for (it = vEntitiesByZ.begin(); it != vEntitiesByZ.end(); it++) {
                bool exclude = false;
                for (unsigned int i = 0; i < excl.size(); i++) {
                    if (it->first == excl[i])
                        exclude = true;
                }
                if (!exclude) {
                    for (unsigned int i = 0; i < it->second[l].size(); i++) {
                        if (it->second[l][i]->isShadow())
                            shadowEntities.push_back(it->second[l][i]);
                        else if (it->second[l][i]->isLight())
                            lightEntities.push_back(it->second[l][i]);
                        else {
                            entities.push_back(it->second[l][i]);
                        }
                    }
                }
            }
        }              
        bool exclude = false;
        for (unsigned int i = 0; i < animatedVisibleEntities.size(); i++) {
            for (unsigned int j = 0; j < excl.size(); j++) {
                if (animatedVisibleEntities[i]->getType() == excl[j])
                    exclude = true;
            }
            if (!exclude) {
                insertAnimatedVisibleEntity(animatedVisibleEntities[i], entities);
            }
        }      
        return entities;
    }
    vector<string> types = split(type, "+");
    for (unsigned int l = 0; l < gridMap->getNbLayers(); l++) {
        for (unsigned int i = 0; i < types.size(); i++) {
            VEntitiesTypeByZ it = vEntitiesByZ.find(types[i]);
            if (it != vEntitiesByZ.end()) {
                for (unsigned int i = 0; i < it->second[l].size(); i++) {
                    if (it->second[l][i]->isShadow())
                        shadowEntities.push_back(it->second[l][i]);
                    else if (it->second[l][i]->isLight())
                        lightEntities.push_back(it->second[l][i]);
                    else {
                        entities.push_back(it->second[l][i]);
                    }
                }
            }
        }
    }
   
    for (unsigned int i = 0; i < animatedVisibleEntities.size(); i++) {

        for (unsigned int j = 0; j < types.size(); j++) {

            if (types[j] == animatedVisibleEntities[i]->getType()) {
                insertAnimatedVisibleEntity(animatedVisibleEntities[i], entities);
            }
        }
    }
    return entities;

}
 

void Map::insertAnimatedVisibleEntity (Entity *ae, std::vector<Entity*>& entities) {

    if (ae->isAnimated()) {
        insertAnimatedVisibleEntity(static_cast<AnimatedEntity*> (ae)->getCurrentEntity(), entities);
    }
    if (ae->isModel() || (ae->getParent() != nullptr && ae->getParent()->isAnimated())) {
        std::vector<Entity*> behind;
        std::vector<Entity*> before;
        std::vector<Entity*> tmpVisibleEntities = entities;
        entities.clear();
        for (unsigned int i = 0; i < tmpVisibleEntities.size(); i++) {

            if (tmpVisibleEntities[i]->getParent() != nullptr
                && (tmpVisibleEntities[i]->getParent()->isModel() || tmpVisibleEntities[i]->getParent()->isAnimated())) {

                Model *m1 = static_cast<Model*>(tmpVisibleEntities[i]->getParent());
                Model *m2 = static_cast<Model*>(ae);
                Vec2f gc1 = m1->getGravityCenter();
                Vec2f gc2 = m2->getGravityCenter();
                Vec2f orig(gc1.x - m1->getSize().x * 0.5f, gc1.y);
                Vec2f ext(gc1.x + m1->getSize().x * 0.5f, gc1.y);
                Segment seg(orig, ext);
                Segment seg2(orig, gc2);
                int det = seg.getDir().x * seg2.getDir().y - seg.getDir().y * seg2.getDir().x;
                (det >= 0) ?  behind.push_back(m1) : before.push_back(m1);
            } else {
                entities.push_back(tmpVisibleEntities[i]);
            }
        }
        tmpVisibleEntities.clear();
        for (unsigned int i = 0; i < behind.size(); i++)
            entities.push_back(behind[i]);
        vector<Entity*> children;
        getChildren(ae, children, "*");
        if (children.size() != 0) {
            for (unsigned int i = 0; i < children.size(); i++) {
                if (!containsVisibleEntity(children[i])
                    && !children[i]->isShadow()
                    && !children[i]->isLight()) {
                    entities.push_back(children[i]);
                }
            }

        } else {
            if (!containsVisibleEntity(ae)) {
                entities.push_back(ae);
            }
        }
        for (unsigned int i = 0; i < before.size(); i++)
           entities.push_back(before[i]);

    }
}
 

In the first function the vector "entities" contains only sprite or shapes (leafs entities of the scene node), but when I pass this vector to the second function, the vector "entities" contains also root scene node entities, it seems that this vector is modified outside the second function and I don't know why.

If I don't pass a reference to the std::vector, the "entities" vector isn't modified so dynamic entities aren't insert.






38
Graphics / Bug : filtering vertices.
« on: March 31, 2014, 11:42:26 am »
Hi, I've made a class to filter all vertices by material and primitive type to put them in a vbo.

I put them in a std::map but when I try to insert them into the std::map I get this error :

Code: [Select]
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h||In member function 'void odfaeg::Listener::connectAction(std::string, odfaeg::ActionMap)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h|26|warning: left operand of comma operator has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h|26|warning: right operand of comma operator has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\..\transformable.h||In member function 'const odfaeg::Matrix4f& odfaeg::Transformable::getMatrix()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\..\transformable.h|136|warning: returning reference to temporary [-Wreturn-local-addr]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\entity.h||In member function 'bool odfaeg::g2d::Entity::removeAttribute(std::string)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\entity.h|106|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'odfaeg::Texture* odfaeg::g2d::Material::getTexture(int)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|42|warning: invalid conversion from 'const odfaeg::Texture*' to 'odfaeg::Texture*' [-fpermissive]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'virtual bool odfaeg::g2d::Face::operator==(odfaeg::g2d::Entity&)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|99|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'void odfaeg::g2d::FaceGroup::Filter::operator==(odfaeg::g2d::FaceGroup::Filter&)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|137|warning: return-statement with a value, in function returning 'void' [-fpermissive]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'void odfaeg::g2d::FaceGroup::zSorting()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|192|warning: unused variable 'zMoy2' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|186|warning: unused variable 'zMoy1' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'void odfaeg::g2d::FaceGroup::alphaSorting()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|215|warning: unused variable 'zMoy2' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|209|warning: unused variable 'aMoy1' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'std::vector<odfaeg::g2d::Face*>& odfaeg::g2d::FaceGroup::getFaces()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|226|warning: statement has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|227|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Core\entitySystem.h|15|warning: ISO C++ forbids declaration of 'launch' with no type [-fpermissive]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Core\entitySystem.h||In member function 'int odfaeg::EntitySystem::launch()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Core\entitySystem.h|20|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h||In member function 'odfaeg::Listener& odfaeg::Application::getListener()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h|109|warning: value computed is not used [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h|109|warning: statement has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h|110|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\signal.h||In instantiation of 'R odfaeg::FastDelegate<R>::operator()() [with R = bool]':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h|123|required from here|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\signal.h|223|warning: cast from 'void*' to 'bool' loses precision [-fpermissive]|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h||In instantiation of 'bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = odfaeg::g2d::FaceGroup::Filter]':|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_tree.h|1791|required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) [with _Key = odfaeg::g2d::FaceGroup::Filter; _Val = std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*>; _KeyOfValue = std::_Select1st<std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*> >; _Compare = std::less<odfaeg::g2d::FaceGroup::Filter>; _Alloc = std::allocator<std::pair<const odfaeg::g2d::FaceGroup::Fil|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_map.h|821|required from 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) [with _Key = odfaeg::g2d::FaceGroup::Filter; _Tp = odfaeg::g2d::FaceGroup*; _Compare = std::less<odfaeg::g2d::FaceGroup::Filter>; _Alloc = std::allocator<std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*> >; std::map|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|157|required from here|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|error: no match for 'operator<' (operand types are 'const odfaeg::g2d::FaceGroup::Filter' and 'const odfaeg::g2d::FaceGroup::Filter')|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note: candidates are:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|250|note: bool std::operator<(const std::error_condition&, const std::error_condition&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|250|note:   no known conversion for argument 1 from 'const odfaeg::g2d::FaceGroup::Filter' to 'const std::error_condition&'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|177|note: bool std::operator<(const std::error_code&, const std::error_code&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|177|note:   no known conversion for argument 1 from 'const odfaeg::g2d::FaceGroup::Filter' to 'const std::error_code&'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h|1420|note: template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h|1420|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::vector<_Tp, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|373|note: template<class _Tp> bool std::operator<(std::nullptr_t, const std::shared_ptr<_Tp1>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|373|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   cannot convert '__x' (type 'const odfaeg::g2d::FaceGroup::Filter') to type 'std::nullptr_t'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|368|note: template<class _Tp> bool std::operator<(const std::shared_ptr<_Tp1>&, std::nullptr_t)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|368|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::shared_ptr<_Tp1>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|359|note: template<class _Tp1, class _Tp2> bool std::operator<(const std::shared_ptr<_Tp1>&, const std::shared_ptr<_Tp2>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|359|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::shared_ptr<_Tp1>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1104|note: template<class _Tp, __gnu_cxx::_Lock_policy _Lp> bool std::operator<(std::nullptr_t, const std::__shared_ptr<_Tp, _Lp>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1104|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   cannot convert '__x' (type 'const odfaeg::g2d::FaceGroup::Filter') to type 'std::nullptr_t'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1099|note: template<class _Tp, __gnu_cxx::_Lock_policy _Lp> bool std::operator<(const std::__shared_ptr<_Tp, _Lp>&, std::nullptr_t)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1099|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::__shared_ptr<_Tp, _Lp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1090|note: template<class _Tp1, class _Tp2, __gnu_cxx::_Lock_policy _Lp> bool std::operator<(const std::__shared_ptr<_Tp1, _Lp>&, const std::__shared_ptr<_Tp2, _Lp>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1090|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::__shared_ptr<_Tp1, _Lp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|540|note: template<class _Tp, class _Dp> bool std::operator<(std::nullptr_t, const std::unique_ptr<_Tp, _Dp>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|540|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   cannot convert '__x' (type 'const odfaeg::g2d::FaceGroup::Filter') to type 'std::nullptr_t'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|534|note: template<class _Tp, class _Dp> bool std::operator<(const std::unique_ptr<_Tp, _Dp>&, std::nullptr_t)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|534|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::unique_ptr<_Tp, _Dp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|523|note: template<class _Tp, class _Dp, class _Up, class _Ep> bool std::operator<(const std::unique_ptr<_Tp, _Dp>&, const std::unique_ptr<_Up, _Ep>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|523|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::unique_ptr<_Tp, _Dp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_multimap.h|880|note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const std::multimap<_Key, _Tp, _Compare, _Alloc>&, const std::multimap<_Key, _Tp, _Compare, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_multimap.h|880|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_map.h|978|note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const std::map<_Key, _Tp, _Compare, _Alloc>&, const std::map<_Key, _Tp, _Compare, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_map.h|978|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::map<_Key, _Tp, _Compare, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\tuple|822|note: template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const std::tuple<_Args1 ...>&, const std::tuple<_Args2 ...>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\tuple|822|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::tuple<_Args1 ...>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\array|238|note: template<class _Tp, unsigned int _Nm> bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\array|238|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::array<_Tp, _Nm>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2593|note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2593|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   mismatched types 'const _CharT*' and 'odfaeg::g2d::FaceGroup::Filter'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2581|note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2581|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2569|note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2569|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_tree.h|914|note: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator<(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_tree.h|914|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1061|note: template<class _Iterator> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1061|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::move_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1055|note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1055|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::move_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|347|note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|347|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::reverse_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|297|note: template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|297|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::reverse_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_pair.h|220|note: template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_pair.h|220|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::pair<_T1, _T2>'|
||=== Build finished: 1 errors, 25 warnings (0 minutes, 9 seconds) ===|

Here is the source code of my file :

#ifndef ODFAEG_FACE_HPP
#define ODFAEG_FACE_HPP
#include "entity.h"
#include "../vertexArray.h"
#include <map>
namespace odfaeg {
    namespace g2d {
class Material {
     private :
     struct TextureInfo {
        private :
        const Texture* texture;
        sf::IntRect rect;
        public :
        TextureInfo (const Texture* texture, sf::IntRect rect) {
            this->texture = texture;
            this->rect = rect;
        }
        bool operator== (TextureInfo& info) {
            return texture == info.texture && rect == info.rect;
        }
        const Texture* getTexture() {
            return texture;
        }
        sf::IntRect getTexRect() {
            return rect;
        }
    };
    std::vector<TextureInfo*> texInfos;
    sf::Color color;
    public :
    int getNbTextures () {
        return texInfos.size();
    }
    void addTexture (const Texture* texture, sf::IntRect rect) {
        texInfos.push_back(new TextureInfo(texture, rect));
    }
    sf::IntRect getTexRect(int textUnit = 0) {
        return (texInfos.size() > 0) ? texInfos[textUnit]->getTexRect() : sf::IntRect(0, 0, 0, 0);
    }
    Texture* getTexture(int textUnit = 0) {
        return (texInfos.size() > 0) ? texInfos[textUnit]->getTexture() : nullptr;
    }
    bool useSameTextures (Material material) {
        if (texInfos.size() != material.texInfos.size())
            return false;
        for (unsigned int i = 0; i < texInfos.size(); i++) {
            if (texInfos[i] != material.texInfos[i])
                return false;
        }
        return true;

    }
    bool hasSameColor (Material& material) {
        return color == material.color;
    }
    bool operator== (Material material) {
        return useSameTextures(material) && hasSameColor(material);
    }

};
class Face : public Entity {
public :
    Face(Vec2f position, Vec2f size, Vec2f origin, std::string type, int layer, VertexArray &vertices, Entity* parent = nullptr) : Entity(position, size, origin, type, layer, parent), vertices(vertices) {

    }
    void append(Vertex vertex) {
        vertices.append(vertex);
    }
    Material& getMaterial() {
        return material;
    }
    void addTexture (Texture *texture, sf::IntRect textRect /*= sf::IntRect(0, 0, texture->getSize().x, texture->getSize().y)*/) {
       material.addTexture(texture, textRect);
    }
    const Texture* getTexture(unsigned int texUnit = 0) {
        return material.getTexture(texUnit);

    }
    sf::IntRect getTextureRect(unsigned int texUnit = 0) {
        return material.getTexRect(texUnit);
    }
    VertexArray& getVertexArray() {
        return vertices;
    }
    bool useSameMaterial(Face& other) {
        return material == other.material;

    }
    bool useSamePrimType (Face &other) {
        return vertices.getPrimitiveType() == other.vertices.getPrimitiveType();
    }
    bool operator== (Entity& other) {
        /*if (getType() != other.getType())
            return false;
        Face& face = static_cast<Face&>(other);
        return vertices == face.vertices
        && material == face.material;*/

    }
    bool isAnimated() const {
        return false;
    }
    bool isModel() const {
        return false;
    }
    bool selectable() const {
        return true;
    }
    bool isLight() const {
        return false;
    }
    bool isShadow() const {
        return false;
    }
    bool isFace() const {
        return true;
    }

private :
    VertexArray& vertices;
    Material material;
};
class Filter {
};
class FaceGroup {
    public :
    struct Filter {
       private :
       sf::PrimitiveType prim_type;
       Material material;
       public :
       Filter (Material material, sf::PrimitiveType prim_type) {
           this->material = material;
           this->prim_type = prim_type;
       }
       void operator== (Filter& f) {
           return material == f.material && prim_type == f.prim_type;
       }
       sf::PrimitiveType get_primitive_type () {
           return prim_type;
       }
       Material get_material()  {
           return material;
       }
    };
    void addFace(Face* face) {
        faces.push_back(face);
    }
    void addFaces(std::vector<Face*>& faces) {
        this->faces.insert(this->faces.end(), faces.begin(), faces.end());
    }
    std::map<Filter, FaceGroup*> filterByMaterialAndPrimType() {
        std::map<Filter, FaceGroup*> fgs;
        std::map<Filter, FaceGroup*>::iterator it;
        for (unsigned int i = 0; i < faces.size(); i++) {
            Filter ft (faces[i]->getMaterial(), faces[i]->getVertexArray().getPrimitiveType());
            it = fgs.find(ft);
            if (it == fgs.end()) {
                fgs.insert(std::pair<Filter, FaceGroup*>(ft, new FaceGroup()));
                it = fgs.find(ft);
            }
            it->second->addFace(faces[i]);
        }
        return fgs;
    }
    bool areAllOfSameType () {
        FaceGroup fg;
        for (unsigned int i = 0; i < faces.size(); i++) {
            for (unsigned int j = 0; j < faces.size(); j++) {
                if (!(faces[i]->getMaterial() == faces[j]->getMaterial())
                    || faces[i]->getVertexArray().getPrimitiveType() != faces[j]->getVertexArray().getPrimitiveType()) {
                    return false;
                }
            }
        }
        return true;
    }
    void zSorting() {
        FaceGroup fg;
        for (unsigned int i = 0; i < faces.size() - 1; i++) {
            int zSum1 = 0;
            for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                zSum1 += faces[i]->getVertexArray()[n].position.z;
            }
            int zMoy1 = zSum1 / faces[i]->getVertexArray().getVertexCount();
            for (unsigned int j = i + 1; j < faces.size(); j++) {
                int zSum2 = 0;
                for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                    zSum2 += faces[j]->getVertexArray()[n].position.z;
                }
                int zMoy2 = zSum2 / faces[j]->getVertexArray().getVertexCount();
                Face* tmp;
                if (zSum2 < zSum1) {
                    tmp = faces[i];
                    faces[i] = faces[j];
                    faces[j] = tmp;
                }
            }
        }
    }
    void alphaSorting() {
        FaceGroup fg;
        for (unsigned int i = 0; i < faces.size() - 1; i++) {
            int aSum1 = 0;
            for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                aSum1 += faces[i]->getVertexArray()[n].color.a;
            }
            int aMoy1 = aSum1 / faces[i]->getVertexArray().getVertexCount();
            for (unsigned int j = i + 1; j < faces.size(); j++) {
                int aSum2 = 0;
                for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                    aSum2 += faces[j]->getVertexArray()[n].color.a;
                }
                int zMoy2 = aSum2 / faces[j]->getVertexArray().getVertexCount();
                Face* tmp;
                if (aSum2 < aSum1) {
                    tmp = faces[i];
                    faces[i] = faces[j];
                    faces[j] = tmp;
                }
            }
        }
    }
    std::vector<Face*>& getFaces() {
        faces;
    }
    ~FaceGroup() {
        for (unsigned int i = 0; i < faces.size(); i++) {
            delete faces[i];
        }
    }

private :
    std::vector<Face*> faces;
};

}
}
#endif // FACE_HPP
 

If I redefine the operator< I get a crash.

bool operator< (const Filter& filter) {
           return this < &filter;
       }
 

Here is what the debuguer show :

Code: [Select]
#0 0049198A __gnu_cxx::new_allocator<odfaeg::g2d::Face*>::construct<odfaeg::g2d::Face*<odfaeg::g2d::Face* const&> >(this=0x7efde000, __p=0xffffffff) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/ext/new_allocator.h:120)
#1 004DC447 std::allocator_traits<std::allocator<odfaeg::g2d::Face*> >::_S_construct<odfaeg::g2d::Face*<odfaeg::g2d::Face* const&> >(std::allocator<odfaeg::g2d::Face*>&, std::allocator_traits<std::allocator<odfaeg::g2d::Face*> >::__construct_helper*, (odfaeg::g2d::Face*<odfaeg::g2d::Face* const&>&&)...)(__a=..., __p=0xffffffff) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/bits/alloc_traits.h:254)
#2 004DC4DF std::allocator_traits<std::allocator<odfaeg::g2d::Face*> >::construct<odfaeg::g2d::Face*<odfaeg::g2d::Face* const&> >(std::allocator<odfaeg::g2d::Face*>&, odfaeg::g2d::Face*<odfaeg::g2d::Face* const&>*, (odfaeg::g2d::Face*<odfaeg::g2d::Face* const&>&&)...)(__a=..., __p=0xffffffff) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/bits/alloc_traits.h:393)
#3 004E9FA5 std::vector<odfaeg::g2d::Face*, std::allocator<odfaeg::g2d::Face*> >::push_back(this=0x7efde000, __x=@0x28f400: 0x32af020) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/bits/stl_vector.h:905)
#4 00488F91 odfaeg::g2d::FaceGroup::addFace(this=0x7efde000, face=0x32af020) (D:/Projets/Projets-c++/ODFAEG/src/odfaeg/Graphics/2D/../../../../include/odfaeg/Graphics/2D/face.h:150)
#5 00488D2F odfaeg::g2d::FaceGroup::filterByMaterialAndPrimType(this=0x145e72c) (D:/Projets/Projets-c++/ODFAEG/src/odfaeg/Graphics/2D/../../../../include/odfaeg/Graphics/2D/face.h:165)
#6 00424DDB odfaeg::g2d::FastRenderComponent::load(this=0x145e528, visibleEntities=...) (D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Graphics\2D\fastRenderComponent.cpp:27)
#7 004174A5 odfaeg::g2d::Map::getVisibleEntities(this=0x145e370, type=...) (D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Graphics\2D\map.cpp:538)
#8 0050045C getVisibleEntities(expression=...) (C:/ODFAEG/include/odfaeg/Core/world.h:35)
#9 ?? onRender (this=0x28fe30) (D:/Projets/Projets-c++/ODFAEG-DEMO/myApplication.h:220)
#10 ?? render (this=0x28fe30) (C:/ODFAEG/include/odfaeg/Core/application.h:62)
#11 ?? exec (this=0x28fe30) (C:/ODFAEG/include/odfaeg/Core/application.h:37)
#12 ?? main () (D:\Projets\Projets-c++\ODFAEG-DEMO\main.cpp:31)

39
Feature requests / MultiTexturing.
« on: March 23, 2014, 01:17:56 pm »
Is the multi-texturing functionnality at the program or not ?

I don't really need it for the moment but for later certainly.

40
Graphics / Opengl displays errors messages with FBO.
« on: March 21, 2014, 12:31:48 pm »
Hi, I've rewritten the SFML classes for the 3D so I just added a z component in the SFML Graphics module, I had also to copy some SFML classes (Texture, RenderTexture, TextureSaver, RenderTextureImple, etc...) in my own project because the m_cache_id and other texture informations used by SFML are only accessible by SFML classes. (because these informations are internal to SFML)

I didn't changed anything for the textures and rendertextures management classe except the namspace nam of course.

But Opengl give me some error message when I delete the render texture, and, especially when they are static, here is the classe which hold the render textures :

#ifndef ODFAEG_TILEMAP_HPP
#define ODFAEG_TILEMAP_HPP
#include "../renderTexture.h"
#include "tile.h"
#include "../shader.h"
namespace odfaeg {
    namespace g2d {
class TileMap : public Entity
{
public:
    TileMap (View& view, const Texture* tileset) : view(view) ,
        Entity (Vec3f (view.getPosition().x, view.getPosition().y, 0), Vec3f(view.getSize().x, view.getSize().y, 0), Vec3f(view.getSize().x * 0.5f, view.getSize().y * 0.5f, 0), "E_TILEMAP") {
        this->view = view;
        // load the tileset texture
        m_tileset = tileset;
    }
    static void genBuffers(unsigned int screenWidth, unsigned int screenHeight) {
        resolution = Vec2f(screenWidth, screenHeight);
        if (Shader::isAvailable()) {
            depthBuffer.create(screenWidth, screenHeight);
            frameBuffer.create(screenWidth, screenHeight);
            const std::string vertexShader = \
            "void main () {" \
                "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;" \
                "gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;" \
                "gl_FrontColor = gl_Color;" \
            "}";
            const std::string  depthGenFragShader = \
            "uniform sampler2D depthBuffer;" \
            "uniform vec2 resolution;" \
            "void main () {" \
                  "vec2 position = ( gl_FragCoord.xy / resolution.xy );" \
                  "vec4 pixel = texture2D(depthBuffer, position);" \
                  "if (gl_FragCoord.z > pixel.z) {" \
                    "gl_FragColor = vec4(0, 0,  gl_FragCoord.z, 1);" \
                  "} else {" \
                     "gl_FragColor = gl_Color * pixel;" \
                  "}" \
            "}";
            const std::string frameBufferGenFragShader = \
            "uniform sampler2D depthBuffer;" \
            "uniform sampler2D frameBuffer;" \
            "uniform sampler2D texture;" \
            "uniform vec2 resolution;" \
            "void main () {     " \
                "vec2 position = ( gl_FragCoord.xy / resolution.xy );" \
                "vec4 depth = texture2D(depthBuffer, position);" \
                "vec4 color = texture2D(frameBuffer, position);" \
                "vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);" \
                "vec4 finalColor = pixel;" \
                "if (gl_FragCoord.z >= depth.z) {" \
                    "gl_FragColor = finalColor;" \
                "} else if (color.a < finalColor.a) {" \
                    "float delta = finalColor.a - color.a;" \
                    "gl_FragColor = color + vec4(finalColor.r * delta, finalColor.g * delta, finalColor.b * delta, delta);" \
                "} else {" \
                    "gl_FragColor = color;" \
                "}" \
            "}";
            if (!depthBufferGenerator.loadFromMemory(vertexShader, depthGenFragShader))
                throw Erreur(50, "Failed to load depth buffer generator shader", 0);
            if (!frameBufferGenerator.loadFromMemory(vertexShader, frameBufferGenFragShader))
                throw Erreur(51, "Failed to load frame buffer generator shader", 0);
             depthBufferGenerator.setParameter("resolution",resolution.x, resolution.y);
             frameBufferGenerator.setParameter("resolution",resolution.x, resolution.y);
        }
    }
    static void clearBufferBits(sf::Color color) {
        frameBuffer.clear(sf::Color(color.r, color.g, color.b, 0));
    }
    static void clearDepthBits() {
        depthBuffer.clear(sf::Color(0, 0, 0, 255));
    }

    bool load(std::vector<Tile*> tiles, sf::PrimitiveType pType = sf::Quads)
    {
        // resize the vertex array to fit the level size
        m_vertices.setPrimitiveType(pType);
        m_vertices.resize(tiles.size() * 4);
        // populate the vertex array, with one quad per tile
        for (unsigned int i = 0; i < tiles.size(); i++) {
            // get a pointer to the current tile's quad

            //Vertex* quad = &m_vertices[i * 4];

            Vec2f position (tiles[i]->getPosition().x, tiles[i]->getPosition().y);
            float zOrder = tiles[i]->getPosition().z - view.getSize().z + 1;
            Vec2f size = Vec2f(tiles[i]->getSize().x, tiles[i]->getSize().y);
            sf::IntRect subRect = tiles[i]->getTextureRect();
            // define its 4 corners
            m_vertices[i*4].position = sf::Vector3f(position.x, position.y, zOrder);
            m_vertices[i*4+1].position = sf::Vector3f(position.x + size.x, position.y, zOrder);
            m_vertices[i*4+2].position = sf::Vector3f(position.x + size.x, position.y + size.y, zOrder);
            m_vertices[i*4+3].position = sf::Vector3f(position.x, position.y + size.y, zOrder);

            // define its 4 texture coordinates
            m_vertices[i*4].texCoords = sf::Vector2f(subRect.left, subRect.top);
            m_vertices[i*4+1].texCoords = sf::Vector2f(subRect.left + subRect.width, subRect.top);
            m_vertices[i*4+2].texCoords = sf::Vector2f(subRect.left + subRect.width, subRect.top + subRect.height);
            m_vertices[i*4+3].texCoords = sf::Vector2f(subRect.left, subRect.top + subRect.height);
        }

        return true;
    }
    static Tile getFrameBufferTile () {
        sf::IntRect subRect(0, 0, frameBuffer.getView().getSize().x, frameBuffer.getView().getSize().y);
        Tile tile (&frameBuffer.getTexture(), Vec2f(frameBuffer.getView().getPosition().x, frameBuffer.getView().getPosition().y), Vec2f(frameBuffer.getView().getSize().x, frameBuffer.getView().getSize().y), subRect, 0);
        return tile;
    }
    static Tile getDepthBufferTile() {
        sf::IntRect subRect(0, 0, depthBuffer.getView().getSize().x, depthBuffer.getView().getSize().y);
        Tile tile (&depthBuffer.getTexture(), Vec2f(depthBuffer.getView().getPosition().x, depthBuffer.getView().getPosition().y), Vec2f(depthBuffer.getView().getSize().x, depthBuffer.getView().getSize().y), subRect, 0);
        return tile;
    }
    bool isAnimated() const {
        return false;
    }
    bool selectable() const {
        return false;
    }
    bool isModel() const {
        return false;
    }
    bool isShadow() const {
        return false;
    }
    bool isLight() const {
        return true;
    }
    const Texture* getTileset() {
        return m_tileset;
    }
    bool operator==(Entity& other) {
        if (other.getType() != "E_TILEMAP")
            return false;
        TileMap& tm = static_cast<TileMap&>(other);
        return m_tileset == tm.m_tileset;
    }
    void clear() {
        m_vertices.clear();
    }

    virtual void onDraw(RenderTarget& target, RenderStates states) const
    {
        // apply the transform
        states.texture = m_tileset;
        if (Shader::isAvailable()) {
            states.shader = &frameBufferGenerator;
            //Update the depth buffer and the frame buffer of the current frame.
            frameBufferGenerator.setParameter("depthBuffer", depthBuffer.getTexture());
            frameBufferGenerator.setParameter("frameBuffer", frameBuffer.getTexture());
            frameBufferGenerator.setParameter("texture", Shader::CurrentTexture);
            frameBuffer.setView(view);
            frameBuffer.draw(m_vertices, states);
            frameBuffer.display();
            //Update the depth buffer.
            depthBuffer.setView(view);
            depthBufferGenerator.setParameter("depthBuffer", depthBuffer.getTexture());
            states.shader = &depthBufferGenerator;
            depthBuffer.draw(m_vertices, states);
            depthBuffer.display();
            states.shader = nullptr;
            states.transform = getTransform();
            Tile tile = getFrameBufferTile();
            tile.move(Vec3f(-view.getSize().x * 0.5f, -view.getSize().y * 0.5f, 0));
            target.draw(tile, states);
        } else {
            states.transform = getTransform();
            target.draw(m_vertices, states);
        }
    }
    private:
    static Shader& getShader() {
        static Shader shader;
        return shader;
    }
    static RenderTexture& getRenderTexture() {
        static RenderTexture renderTexture;
        return renderTexture;
    }
    VertexArray m_vertices;
    const Texture* m_tileset;
    static RenderTexture depthBuffer;
    static RenderTexture frameBuffer;
    static Shader& depthBufferGenerator;
    static Shader& frameBufferGenerator;
    static Vec2f resolution;
    View& view;
};
}
}
#endif // TILEMAP

 

When I close the application I have this error message :

An internal OpenGL call failed in renderTextureImplFBO.cpp (65) : GL_INVALID_VALUE, a numeric argument is out of range.

I've printed the frameBuffer id in the console and they are correct (1 for the frameBuffer render texture and 2 for the depthBuffer render texture)

I've a question so, is it a problem if the renderwindow is destroyed before the RenderTextures ?

But even if I don't destroy the window, the problem remains....




41
General / CMake doesn't find the SFML config module
« on: March 14, 2014, 06:56:32 pm »
Hi, I try to compile a project which uses SFML on linux but it doesn't seems to work.

CMake give me the followings errors messages :

Code: [Select]
Found SFML . in /usr/SFML-2.1/include
CMake Error at src/odfaeg/Core/CMakeLists.txt:44 (find_package):
  Could not find module FindSFML.cmake or a configuration file for package
  SFML.

  Adjust CMAKE_MODULE_PATH to find FindSFML.cmake or set SFML_DIR to the
  directory containing a CMake configuration file for SFML.  The file will
  have one of the following names:

    SFMLConfig.cmake
    sfml-config.cmake



configuring incomplete, errors occurred!

But, it work on window, when I add this lines in the CMakeList :
Code: [Select]
include(${PROJECT_SOURCE_DIR}/cmake/Modules/FindSFML.cmake)

It's very strange, the SFML dir is in usr/SFML-2.1.

It finds the SFML dir so but it doesn't find the FindSFML.cmake on my ubuntu...

42
Graphics / [Crash] using shader with rendertextures.
« on: March 14, 2014, 02:39:23 pm »
Hi, i'm trying to put a set of 3D or 2D entities using the same texture in a tilemap and I use a shader and two render textures to render them because I've semi-transparent textures.

But I've a problem :
Here's the code of my tilemap class :

#ifndef TILEMAP
#define TILEMAP
#include "renderTexture.h"
#include "tile.h"
#include "shader.h"
namespace odfaeg {
    namespace g3d {
class TileMap : public Drawable, public Transformable
{
public:
    TileMap (View& view, int zOrder = 0) : view(view) ,
        Transformable (Vec3f (view.getPosition().x, view.getPosition().y, zOrder), Vec3f(view.getSize().x, view.getSize().y, 0), Vec3f(view.getSize().x * 0.5f, view.getSize().y * 0.5f, 0)) {
        this->zOrder = zOrder;
        this->view = view;
    }
    static void genBuffers(int screenWidth, int screenHeight) {
        resolution = Vec2f(screenWidth, screenHeight);
        depthBuffer.create(resolution.x, resolution.y);
        frameBuffer.create(resolution.x, resolution.y);
        const std::string vertexShader = \
        "void main () {" \
            "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;" \
            "gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;" \
            "gl_FrontColor = gl_Color;" \
        "}";
        const std::string  depthGenFragShader = \
        "uniform sampler2D depthBuffer;" \
        "uniform vec2 resolution;" \
        "void main () {" \
              "vec2 position = ( gl_FragCoord.xy / resolution.xy );" \
              "vec4 pixel = texture2D(depthBuffer, position);" \
              "if (gl_FragCoord.z > pixel.z) {" \
                "gl_FragColor = vec4(0, 0,  gl_FragCoord.z, 1);" \
              "} else {" \
                 "gl_FragColor = gl_Color * pixel;" \
              "}" \
        "}";
        const std::string frameBufferGenFragShader = \
        "uniform sampler2D depthBuffer;" \
        "uniform sampler2D frameBuffer;" \
        "uniform sampler2D texture;" \
        "uniform vec2 resolution;" \
        "void main () { " \
            "vec2 position = ( gl_FragCoord.xy / resolution.xy );" \
            "vec4 depth = texture2D(depthBuffer, position);" \
            "vec4 color = texture2D(frameBuffer, position);" \
            "vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);" \
            "vec4 finalColor = pixel;" \
            "if (gl_FragCoord.z >= depth.z) {" \
                "float delta = color.a - finalColor.a;" \
                "gl_FragColor = color + vec4(finalColor.r * delta, finalColor.g * delta, finalColor.b * delta, delta);" \
                "gl_FragColor = finalColor;" \
            "} else if (color.a < finalColor.a) {" \
                "float delta = finalColor.a - color.a;" \
                "gl_FragColor = color + vec4(finalColor.r * delta, finalColor.g * delta, finalColor.b * delta, delta);" \
            "} else {" \
                "gl_FragColor = color;" \
            "}" \
            "}";
        if (!depthBufferGenerator->loadFromMemory(vertexShader, depthGenFragShader))
            throw Erreur(50, "Failed to load depth buffer generator shader", 0);
        if (!frameBufferGenerator->loadFromMemory(vertexShader, frameBufferGenFragShader))
            throw Erreur(51, "Failed to load frame buffer generator shader", 0);
         depthBufferGenerator->setParameter("resolution",resolution.x, resolution.y);
         frameBufferGenerator->setParameter("resolution",resolution.x, resolution.y);
    }
    static void clearBufferBits(sf::Color color) {
        frameBuffer.clear(sf::Color(color.r, color.g, color.b, 0));
    }
    static void clearDepthBits() {
        depthBuffer.clear(sf::Color(0, 0, 0, 255));
    }

    bool load(const Texture& tileset, std::vector<Tile*> tiles)
    {
        // load the tileset texture
        m_tileset = tileset;

        // resize the vertex array to fit the level size
        m_vertices.setPrimitiveType(sf::Quads);
        m_vertices.resize(tiles.size() * 4);

        // populate the vertex array, with one quad per tile
        for (unsigned int i = 0; i < tiles.size(); i++) {
                // get a pointer to the current tile's quad

                Vertex* quad = &m_vertices[i * 4];
                Vec2f position (tiles[i]->getPosition().x, tiles[i]->getPosition().y);
                float zOrder = tiles[i]->getPosition().z;
                Vec2f size = Vec2f(tiles[i]->getSize().x, tiles[i]->getSize().y);
                sf::IntRect subRect = tiles[i]->getTextureRect();
                // define its 4 corners
                quad[i*4].position = sf::Vector3f(position.x, position.y, zOrder);
                quad[i*4+1].position = sf::Vector3f(position.x + size.x, position.y, zOrder);
                quad[i*4+2].position = sf::Vector3f(position.x + size.x, position.y + size.y, zOrder);
                quad[i*4+3].position = sf::Vector3f(position.x, position.y + size.y, zOrder);

                // define its 4 texture coordinates
                quad[i*4].texCoords = sf::Vector2f(subRect.left, subRect.top);
                quad[i*4+1].texCoords = sf::Vector2f(subRect.left + subRect.width, subRect.top);
                quad[i*4+2].texCoords = sf::Vector2f(subRect.left + subRect.width, subRect.top + subRect.height);
                quad[i*4+3].texCoords = sf::Vector2f(subRect.left, subRect.top + subRect.height);
            }

        return true;
    }
    static Tile getFrameBufferTile () {
        sf::IntRect subRect(0, 0, frameBuffer.getView().getSize().x, frameBuffer.getView().getSize().y);
        Tile tile (&frameBuffer.getTexture(), frameBuffer.getView().getPosition(), frameBuffer.getView().getSize(), subRect, 0);
        return tile;
    }
    static Tile getDepthBufferTile() {
        sf::IntRect subRect(0, 0, depthBuffer.getView().getSize().x, depthBuffer.getView().getSize().y);
        Tile tile (&depthBuffer.getTexture(), depthBuffer.getView().getPosition(), depthBuffer.getView().getSize(), subRect, 0);
        return tile;
    }
private:
    virtual void draw(RenderTarget& target, RenderStates states) const
    {
        // apply the transform
        states.texture = &m_tileset;
        states.shader = frameBufferGenerator;
        //Update the depth buffer and the frame buffer of the current frame.
        frameBufferGenerator->setParameter("depthBuffer", depthBuffer.getTexture());
        frameBufferGenerator->setParameter("frameBuffer", frameBuffer.getTexture());
        frameBufferGenerator->setParameter("texture", Shader::CurrentTexture);
        frameBuffer.setView(view);
        frameBuffer.draw(m_vertices, states);
        frameBuffer.display();
        //Update the depth buffer.
        depthBuffer.setView(view);
        depthBufferGenerator->setParameter("depthBuffer", depthBuffer.getTexture());
        states.shader = depthBufferGenerator;
        depthBuffer.draw(m_vertices, states);
        depthBuffer.display();
        states.shader = nullptr;
        states.transform = getTransform();
        Tile tile = getFrameBufferTile();
        tile.move(Vec3f(-view.getSize().x * 0.5f, -view.getSize().y * 0.5f, 0));
        target.draw(tile, states);

    }
    VertexArray m_vertices;
    Texture m_tileset;
    static RenderTexture depthBuffer;
    static RenderTexture frameBuffer;
    static Shader *depthBufferGenerator;
    static Shader *frameBufferGenerator;
    int zOrder;
    static Vec2f resolution;
    View& view;
};
}
}
#endif // TILEMAP
 

So I want to put a set of 3D tiles here.

It work when I have only one quad per tilemap but when I want to load more than one quad (in other words, when I put more than one tiles un the tilemap), it crashes and the debuguers gives me this error :

Code: [Select]
#0 03060D85 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#1 0308BED8 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#2 0308AF84 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#3 0305C87E atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#4 02E27531 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#5 02E4A76F atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#6 02E4D218 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#7 03037EA1 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#8 0302E009 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#9 0302F522 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#10 0302F375 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#11 0303D67A atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#12 0279907B atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#13 02AAC3E9 atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#14 028AF92E atioglxx!DrvPresentBuffers() (C:\Windows\SysWOW64\atioglxx.dll:??)
#15 004DEF73 main() (D:\Projets\Projets-c++\Test3DODFAEG\main.cpp:64)

It crash when I want to clear the window, here's my code :

#include "ODFAEG/Graphics/3D/renderWindow.h"
#include "ODFAEG/Graphics/3D/tile.h"
#include "ODFAEG/Graphics/3D/tileMap.h"
#include "ODFAEG/Graphics/3D/tile.h"
#include "ODFAEG/Graphics/3D/wall.h"
#include "ODFAEG/Graphics/3D/map.h"
#include "ODFAEG/Graphics/3D/cube.h"
#include "ODFAEG/Core/ResourceManager.h"
#include "ODFAEG/Math/projMatrix.h"
using namespace odfaeg;
using namespace odfaeg::g3d;


int main() {

    RenderWindow window(sf::VideoMode(800, 600), "TestODFAEG", sf::Style::Default, sf::ContextSettings(32));
    View &view = window.getView();
    view.setUpVector(Vec3f(0, -1, 0));
    view.scale(-1, 1, 1);
    view.move(-400, -300, 0);
    AABB viewRect(Vec3f(view.getPosition().x, view.getPosition().y, 0), view.getSize().x, view.getSize().y, 0);
    TileMap::genBuffers(view.getSize().x, view.getSize().y);
    Texture t1;
    Texture t2;
    t1.loadFromFile("tilesets/herbe.png");
    t2.loadFromFile("tilesets/murs.png");
    std::vector<Tile*> tiles;
    tiles.push_back(new Tile(&t1, Vec2f(0, 0), Vec2f(120, 60),sf::IntRect(0, 0, 100, 50), 0));
    tiles.push_back(new Tile(&t1, Vec2f(100, 50), Vec2f(120, 60),sf::IntRect(0, 0, 100, 50), 0));  
    TileMap tm1(view);  
    tm1.load(t1, tiles);
    while(window.isOpen()) {
       

        sf::Event event;
        while(window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color(0, 0, 0));
        TileMap::clearBufferBits(sf::Color(0, 0, 0));
        TileMap::clearDepthBits();
        window.draw(tm1);
        window.display();

    }

    return 0;
}
 

I've an ATI mobility Radeon HD 5470 as graphical card.

I've checked out my driver but it seems it's up to date.








43
Hi,

SFML don't allow us to display 3D objects, so, I've re-create the classes RenderTarget, RenderWindow, Vertex, VertexArray, ..., which can display 3D objects.

And I didn't want to modify SFML. (because if the SFML version change I'll have to modify all again)

It's why I've recreate similar classes for the 3D.

But I had to modify a little thing in the sfml source code, this is the m_cacheId, in the sf::Texture class.

Because the m_cacheId and some other attributes are private, so, I've moved them into the public part of the sf::Texture class otherwise only the friend class sf::RenderTarget can access to them.

Otherwise this is very nice that the SFML classes encapsulate the opengl code.

Shaders and textures becomes very more simple to implement. (This is why I keep using sfml even for the 3D)






44
Graphics / Question regarding rendertextures.
« on: March 01, 2014, 09:58:51 pm »
Hi !

I would like to know if it's possible to get the zPosition of pixels from a rendertexture in a fragment shader just like it's shown in this following link with an fbo :


http://ogldev.atspace.co.uk/www/tutorial23/tutorial23.html

Or should I reimplement the render texture class ?
I would like to do a two pass rendering with a depth and alpha test.

45
Graphics / Question with shaders :
« on: February 28, 2014, 06:03:30 pm »
Hi, I would like to retrieve the alpha component of the previous pixel in a fragment shader by setting the alpha blending on GL_DST_ALPHA like it's say it in this link :
http://www.developpez.net/forums/d1155703/applications/developpement-2d-3d-jeux/api-graphiques/opengl/glsl-pixel-precedent-fragment-shader/

But I don't know how to proceed. :/

When I've set the blending function to GL_DST_ALPHA, how can I retrieve the alpha value of the previous pixel in the fragment shader ?


Pages: 1 2 [3] 4