Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 29/12/2018, à 15:25

Laurentdur

Installer une ancienne version d'un driver propriétaire sur ubuntu.

Salut!
Je voudrais installer le driver ati version 8.84 sous ubuntu pour ma carte graphique HD Mobility Radeon 5470.
Mais impossible de trouver ce driver sur le site amd et sur ubuntu le nouveau driver propriétaire fglrx ne fonctionne pas car il m'installe la nouvelle version qui est incompatible avec ma carte graphique.

Sur le site de asus il y est mais pour windows seulement.

Ici

Dernière modification par Laurentdur (Le 29/12/2018, à 15:26)

Hors ligne

#2 Le 29/12/2018, à 16:27

Laurentdur

Re : Installer une ancienne version d'un driver propriétaire sur ubuntu.

Bon je l'ai trouvé en fait sur ce lien :
Ici
mais il ne fonctionne pas j'ai un écran noir à la place de l'écran de login or que sur windows il fonctionne.

Le driver opensource ne fonctionne pas j'ai un bug ici

#include "../../../include/odfaeg/Graphics/lightRenderComponent.hpp"
#include "glCheck.h"
#include <memory.h>
using namespace sf;
using namespace std;
namespace odfaeg {
    namespace graphic {
        LightRenderComponent::LightRenderComponent (RenderWindow& window, int layer, std::string expression) :
                    HeavyComponent(window, math::Vec3f(window.getView().getPosition().x, window.getView().getPosition().y, layer),
                                  math::Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0),
                                  math::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()),
                    expression(expression) {
                    update = false;
                    sf::Vector3i resolution ((int) window.getSize().x, (int) window.getSize().y, window.getView().getSize().z);
                    depthBuffer = std::make_unique<RenderTexture>();
                    specularTexture = std::make_unique<RenderTexture>();
                    bumpTexture = std::make_unique<RenderTexture>();
                    lightMap = std::make_unique<RenderTexture>();
                    normalMap = std::make_unique<RenderTexture>();
                    sf::ContextSettings settings;
                    settings.depthBits = 32;
                    depthBuffer->create(resolution.x, resolution.y,settings);
                    normalMap->create(resolution.x, resolution.y,window.getSettings());
                    specularTexture->create(resolution.x, resolution.y,settings);
                    bumpTexture->create(resolution.x, resolution.y,settings);
                    lightMap->create(resolution.x, resolution.y,window.getSettings());
                    normalMap->setView(window.getView());
                    depthBuffer->setView(window.getView());
                    specularTexture->setView(window.getView());
                    bumpTexture->setView(window.getView());
                    lightMap->setView(window.getView());
                    lightMapTile = std::make_unique<Tile>(&lightMap->getTexture(), math::Vec3f(0, 0, 0), math::Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0), IntRect(0, 0, window.getView().getSize().x, window.getView().getSize().y));
                    depthBufferTile = std::make_unique<Tile>(&depthBuffer->getTexture(), math::Vec3f(0, 0, 0), math::Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0), IntRect(0, 0, window.getView().getSize().x, window.getView().getSize().y));
                    normalMapTile = std::make_unique<Tile>(&normalMap->getTexture(), math::Vec3f(0, 0, 0), math::Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0), IntRect(0, 0, window.getView().getSize().x, window.getView().getSize().y));
                    specularBufferTile = std::make_unique<Tile>(&specularTexture->getTexture(), math::Vec3f(0, 0, 0), math::Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0), IntRect(0, 0, window.getView().getSize().x, window.getView().getSize().y));
                    bumpMapTile = std::make_unique<Tile>(&bumpTexture->getTexture(), math::Vec3f(0, 0, 0), math::Vec3f(window.getView().getSize().x, window.getView().getSize().y, 0), IntRect(0, 0, window.getView().getSize().x, window.getView().getSize().y));
                    core::FastDelegate<bool> signal (&LightRenderComponent::needToUpdate, this);
                    core::FastDelegate<void> slot (&LightRenderComponent::drawNextFrame, this);
                    core::Command cmd(signal, slot);
                    getListener().connect("UPDATE", cmd);
                    if (Shader::isAvailable()) {
                        lightMapGenerator = std::make_unique<Shader>();
                        depthBufferGenerator = std::make_unique<Shader>();
                        specularTextureGenerator = std::make_unique<Shader>();
                        bumpTextureGenerator = std::make_unique<Shader>();
                        normalMapGenerator = std::make_unique<Shader>();
                        const std::string  vertexShader =
                        "#version 130 \n"
                        "out mat4 projMat;"
                        "void main () {"
                            "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
                            "gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;"
                            "gl_FrontColor = gl_Color;"
                            "projMat = gl_ProjectionMatrix;"
                        "}";
                        const std::string  buildNormalMapVertexShader =
                        "#version 130 \n"
                        "void main () {"
                            "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
                            "gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;"
                            "gl_FrontColor = gl_Color;"
                        "}";
                        const std::string buildNormalMapFragmentShader =
                        "#version 130 \n"
                        "const vec2 size = vec2(2.0,0.0);"
                        "const ivec3 off = ivec3(-1,0,1);"
                        "uniform sampler2D depthBuffer;"
                        "void main() {"
                            "vec4 depth = texture2D(depthBuffer, gl_TexCoord[0].xy);"
                            "float s01 = textureOffset(depthBuffer, gl_TexCoord[0].xy, off.xy).z;"
                            "float s21 = textureOffset(depthBuffer, gl_TexCoord[0].xy, off.zy).z;"
                            "float s10 = textureOffset(depthBuffer, gl_TexCoord[0].xy, off.yx).z;"
                            "float s12 = textureOffset(depthBuffer, gl_TexCoord[0].xy, off.yz).z;"
                            "vec3 va = normalize (vec3(size.xy, s21 - s01));"
                            "vec3 vb = normalize (vec3(size.yx, s12 - s10));"
                            "gl_FragColor = vec4(cross(va, vb), depth.z);"
                        "}";
                        const std::string depthGenFragShader =
                        "#version 130 \n"
                        "uniform sampler2D texture;"
                        "uniform float haveTexture;"
                        "in mat4 projMat;"
                        "void main () {"
                            "vec4 texel = texture2D(texture, gl_TexCoord[0].xy);"
                            "vec4 colors[2];"
                            "colors[1] = texel * gl_Color;"
                            "colors[0] = gl_Color;"
                            "bool b = (haveTexture == 1);"
                            "float current_alpha = colors[int(b)].a;"
                            "float current_depth = (gl_FragCoord.w != 1.f) ? (inverse(projMat) * vec4(0, 0, 0, gl_FragCoord.w)).w : gl_FragCoord.z;"
                            "gl_FragColor = vec4(0, 0, current_depth, current_alpha);"
                        "}";
                        const std::string specularGenFragShader =
                        "#version 130 \n"
                        "uniform sampler2D texture;"
                        "uniform float maxM;"
                        "uniform float maxP;"
                        "uniform float m;"
                        "uniform float p;"
                        "uniform float haveTexture;"
                        "in mat4 projMat;"
                        "void main() {"
                            "vec4 texel = texture2D(texture, gl_TexCoord[0].xy);"
                            "vec4 colors[2];"
                            "colors[1] = texel * gl_Color;"
                            "colors[0] = gl_Color;"
                            "bool b = (haveTexture == 1);"
                            "vec4 color = colors[int(b)];"
                            "float z = (gl_FragCoord.w != 1.f) ? (inverse(projMat) * vec4(0, 0, 0, gl_FragCoord.w)).w : gl_FragCoord.z;"
                            "float intensity = (maxM != 0.f) ? m / maxM : 0.f;"
                            "float power = (maxP != 0.f) ? p / maxP : 0.f;"
                            "gl_FragColor = vec4(intensity, power, z, color.a);"
                        "}";
                         const std::string bumpGenFragShader =
                         "#version 130 \n"
                         "uniform sampler2D texture;"
                         "uniform float haveTexture;"
                         "void main() {"
                             "vec4 texel = texture2D(texture, gl_TexCoord[0].xy);"
                             "vec4 colors[2];"
                             "colors[1] = texel * gl_Color;"
                             "colors[0] = gl_Color;"
                             "bool b = (haveTexture == 1);"
                             "vec4 color = colors[int(b)];"
                             "gl_FragColor = color;"
                         "}";
                         const std::string perPixLightingFragmentShader =
                         "#version 130 \n"
                         "const vec2 size = vec2(2.0,0.0);"
                         "const ivec3 off = ivec3(-1,0,1);"
                         "uniform sampler2D normalMap;"
                         "uniform sampler2D specularTexture;"
                         "uniform sampler2D bumpMap;"
                         "uniform sampler2D lightMap;"
                         "uniform vec3 resolution;"
                         "uniform vec4 lightColor;"
                         "uniform vec4 lightPos;"
                         "in mat4 projMat;"
                         "void main () { "
                             "vec2 position = vec2 (gl_FragCoord.xy / resolution.xy);"
                             "vec4 normal = texture2D(normalMap, position);"
                             "vec4 bump = texture2D(bumpMap, position);"
                             "vec4 lightMapColor = texture2D(lightMap, position);"
                             "vec4 specularInfos = texture2D(specularTexture, position);"
                             "vec3 sLightPos = vec3 (lightPos.x, lightPos.y, -lightPos.z * (gl_DepthRange.far - gl_DepthRange.near));"
                             "float radius = lightPos.w;"
                             "vec3 pixPos = vec3 (gl_FragCoord.x, gl_FragCoord.y, -normal.w * (gl_DepthRange.far - gl_DepthRange.near));"
                             "vec3 viewPos = vec3(resolution.x * 0.5f, resolution.y * 0.5f, 0);"
                             "float z = (gl_FragCoord.w != 1.f) ? (inverse(projMat) * vec4(0, 0, 0, gl_FragCoord.w)).w : gl_FragCoord.z;"
                             "vec3 vertexToLight = sLightPos - pixPos;"
                             "if (bump.x != 0 || bump.y != 0 || bump.z != 0) {"
                                 "float s01 = textureOffset(normalMap, position, off.xy).z;"
                                 "float s21 = textureOffset(normalMap, position, off.zy).z;"
                                 "float s10 = textureOffset(normalMap, position, off.yx).z;"
                                 "float s12 = textureOffset(normalMap, position, off.yz).z;"
                                 "vec3 tmpNormal = (normal.xyz);"
                                 "vec3 tangeant = normalize (vec3(size.xy, s21 - s01));"
                                 "vec3 binomial = normalize (vec3(size.yx, s12 - s10));"
                                 "normal.x = dot(vertexToLight, tangeant);"
                                 "normal.y = dot(vertexToLight, binomial);"
                                 "normal.z = dot(vertexToLight, tmpNormal);"
                                 "normal.w = bump.w;"
                             "}"
                             "if (z >= normal.w) {"
                                 "vec4 specularColor = vec4(0, 0, 0, 0);"
                                 "float attenuation = 1.f - length(vertexToLight) / radius;"
                                 "vec3 pixToView = pixPos - viewPos;"
                                 "float normalLength = dot(normal.xyz, vertexToLight);"
                                 "vec3 lightReflect = vertexToLight + 2 * (normal.xyz * normalLength - vertexToLight);"
                                 "float m = specularInfos.r;"
                                 "float p = specularInfos.g;"
                                 "float specularFactor = dot(normalize(pixToView), normalize(lightReflect));"
                                 "specularFactor = pow (specularFactor, p);"
                                 "if (specularFactor > 0) {"
                                     "specularColor = vec4(lightColor.rgb, 1) * m * specularFactor;"
                                 "}"
                                 "if (normal.x != 0 || normal.y != 0 || normal.z != 0 && vertexToLight.z > 0.f) {"
                                     "vec3 dirToLight = normalize(vertexToLight.xyz);"
                                     "float nDotl = dot (dirToLight, normal.xyz);"
                                     "attenuation *= nDotl;"
                                 "}"
                                 "gl_FragColor = vec4(lightColor.xyz, 1) * max(0.0f, attenuation) + specularColor;"
                             "} else {"
                                 "gl_FragColor = lightMapColor;"
                             "}"
                        "}";
                        if (!depthBufferGenerator->loadFromMemory(vertexShader, depthGenFragShader))
                            throw core::Erreur(50, "Failed to load depth buffer generator shader", 0);
                        if (!normalMapGenerator->loadFromMemory(buildNormalMapVertexShader, buildNormalMapFragmentShader))
                            throw core::Erreur(51, "Failed to load normal generator shader", 0);
                        if (!specularTextureGenerator->loadFromMemory(vertexShader, specularGenFragShader))
                            throw core::Erreur(52, "Failed to load specular texture generator shader", 0);
                        if (!bumpTextureGenerator->loadFromMemory(buildNormalMapVertexShader, bumpGenFragShader))
                            throw core::Erreur(53, "Failed to load bump texture generator shader", 0);
                        if (!lightMapGenerator->loadFromMemory(vertexShader, perPixLightingFragmentShader))
                            throw core::Erreur(54, "Failed to load light map generator shader", 0);
                        normalMapGenerator->setParameter("depthBuffer", Shader::CurrentTexture);
                        depthBufferGenerator->setParameter("texture", Shader::CurrentTexture);
                        specularTextureGenerator->setParameter("texture",Shader::CurrentTexture);
                        specularTextureGenerator->setParameter("maxM", Material::getMaxSpecularIntensity());
                        specularTextureGenerator->setParameter("maxP", Material::getMaxSpecularPower());
                        bumpTextureGenerator->setParameter("texture",Shader::CurrentTexture);
                        lightMapGenerator->setParameter("resolution", resolution.x, resolution.y, resolution.z);
                        lightMapGenerator->setParameter("normalMap", normalMap->getTexture());
                        lightMapGenerator->setParameter("specularTexture",specularTexture->getTexture());
                        lightMapGenerator->setParameter("bumpTexture",bumpTexture->getTexture());
                        lightMapGenerator->setParameter("lightMap",lightMap->getTexture());
                    } else {
                        throw core::Erreur(55, "Shader not supported!", 0);
                    }
            }
            void LightRenderComponent::pushEvent(sf::Event event, RenderWindow& rw) {
                if (event.type == sf::Event::Resized && &getWindow() == &rw && isAutoResized()) {
                    std::cout<<"recompute size"<<std::endl;
                    recomputeSize();
                    getListener().pushEvent(event);
                    getView().reset(physic::BoundingBox(getView().getViewport().getPosition().x, getView().getViewport().getPosition().y, getView().getViewport().getPosition().z, event.size.width, event.size.height, getView().getViewport().getDepth()));
                }
            }
            bool LightRenderComponent::needToUpdate() {
            return update;
        }
        void LightRenderComponent::changeVisibleEntities(Entity* toRemove, Entity* toAdd, EntityManager* em) {
            if (expression.find(toAdd->getRootType())) {
                bool removed;
                em->removeAnimatedVisibleEntity(toRemove, visibleEntities, view, removed);
                if (removed) {
                    em->insertAnimatedVisibleEntity(toAdd, visibleEntities, view);
                    loadEntitiesOnComponent(visibleEntities);
                    update = true;
                }
            }
        }
        std::string LightRenderComponent::getExpression() {
            return expression;
        }
        void LightRenderComponent::clear() {
             normalMap->clear(sf::Color::Transparent);
             depthBuffer->clear(sf::Color::Transparent);
             specularTexture->clear(sf::Color::Transparent);
             bumpTexture->clear(sf::Color::Transparent);
             sf::Color ambientColor = g2d::AmbientLight::getAmbientLight().getColor();
             lightMap->clear(ambientColor);
        }
        Tile& LightRenderComponent::getNormalMapTile () {
            return *normalMapTile;
        }
        Tile& LightRenderComponent::getDepthBufferTile() {
            return *depthBufferTile;
        }
        Tile& LightRenderComponent::getspecularTile () {
            return *specularBufferTile;
        }
        Tile& LightRenderComponent::getBumpTile() {
            return *bumpMapTile;
        }
        Tile& LightRenderComponent::getLightTile() {
            return *lightMapTile;
        }
        const Texture& LightRenderComponent::getDepthBufferTexture() {
            return depthBuffer->getTexture();
        }
        const Texture& LightRenderComponent::getnormalMapTexture() {
            return normalMap->getTexture();
        }
        const Texture& LightRenderComponent::getSpecularTexture() {
            return specularTexture->getTexture();
        }
        const Texture& LightRenderComponent::getbumpTexture() {
            return bumpTexture->getTexture();
        }
        const Texture& LightRenderComponent::getLightMapTexture() {
            return lightMap->getTexture();
        }
        bool LightRenderComponent::loadEntitiesOnComponent(std::vector<Entity*> vEntities)
        {

            batcher.clear();
            lightBatcher.clear();
            for (unsigned int i = 0; i < vEntities.size(); i++) {
                if ( vEntities[i]->isLeaf()) {
                    if (vEntities[i]->isLight()) {
                        for (unsigned int j = 0; j <  vEntities[i]->getFaces().size(); j++) {
                            lightBatcher.addFace(vEntities[i]->getFaces()[j], vEntities[i]);
                        }
                    } else {
                        for (unsigned int j = 0; j <  vEntities[i]->getFaces().size(); j++) {
                            batcher.addFace(vEntities[i]->getFaces()[j], vEntities[i]);
                        }
                    }
                }
            }
            m_instances = batcher.getInstances();
            m_light_instances = lightBatcher.getInstances();
            visibleEntities = vEntities;
            update = true;
            return true;
        }
        void LightRenderComponent::setView(View view){
            this->view = view;
            normalMap->setView(view);
            depthBuffer->setView(view);
            specularTexture->setView(view);
            bumpTexture->setView(view);
            lightMap->setView(view);
        }
        void LightRenderComponent::setExpression(std::string expression) {
            update = true;
            this->expression = expression;
        }
        void LightRenderComponent::drawNextFrame() {
            update = false;
            RenderStates states;
            states.blendMode = sf::BlendNone;
            physic::BoundingBox viewArea = view.getViewVolume();
            math::Vec3f position (viewArea.getPosition().x,viewArea.getPosition().y, view.getPosition().z);
            math::Vec3f size (viewArea.getWidth(), viewArea.getHeight(), 0);
            for (unsigned int i = 0; i < m_instances.size(); i++) {
                float specularIntensity = m_instances[i].getMaterial().getSpecularIntensity();
                float specularPower = m_instances[i].getMaterial().getSpecularPower();
                specularTextureGenerator->setParameter("m", specularIntensity);
                specularTextureGenerator->setParameter("p", specularPower);
                if (m_instances[i].getMaterial().getTexture() != nullptr) {
                    depthBufferGenerator->setParameter("haveTexture", 1.f);
                    specularTextureGenerator->setParameter("haveTexture", 1.f);
                } else {
                    depthBufferGenerator->setParameter("haveTexture", 0.f);
                    specularTextureGenerator->setParameter("haveTexture", 0.f);
                }
                if (m_instances[i].getMaterial().getBumpTexture() != nullptr) {
                    bumpTextureGenerator->setParameter("haveTexture", 1.f);
                } else {
                    bumpTextureGenerator->setParameter("haveTexture", 0.f);
                }
                states.texture = m_instances[i].getMaterial().getTexture();
                states.shader = depthBufferGenerator.get();
                depthBuffer->draw(m_instances[i].getAllVertices(), states);
                states.shader = specularTextureGenerator.get();
                specularTexture->draw(m_instances[i].getAllVertices(), states);
                states.shader = bumpTextureGenerator.get();
                states.texture = m_instances[i].getMaterial().getBumpTexture();
                bumpTexture->draw(m_instances[i].getAllVertices(), states);
            }
            depthBufferTile->setCenter(position);
            states.shader = normalMapGenerator.get();
            normalMap->draw(*depthBufferTile, states);
            states.shader = lightMapGenerator.get();
            states.blendMode = sf::BlendAdd;
            for (unsigned int i = 0; i < m_light_instances.size(); i++) {
                for (unsigned int j = 0; j < m_light_instances[i].getVertexArrays().size(); j++) {
                    states.transform =  m_light_instances[i].getTransforms()[j];
                    EntityLight* el = static_cast<EntityLight*> (m_light_instances[i].getVertexArrays()[j].getEntity());
                    math::Vec3f center = getWindow().mapCoordsToPixel(el->getLightCenter(), view);
                    center.w = el->getSize().x * 0.5f;
                    lightMapGenerator->setParameter("lightPos", center.x, center.y, center.z, center.w);
                    lightMapGenerator->setParameter("lightColor", el->getColor().r, el->getColor().g,el->getColor().b,el->getColor().a);
                    lightMap->draw(m_light_instances[i].getVertexArrays()[j], states);
                }
            }
            depthBuffer->display();
            specularTexture->display();
            bumpTexture->display();
            normalMap->display();
            lightMap->display();
            normalMapTile->setPosition(position);
            bumpMapTile->setPosition(position);
            specularBufferTile->setPosition(position);
            lightMapTile->setPosition(position);
        }
        std::vector<Entity*> LightRenderComponent::getEntities() {
            return visibleEntities;
        }
        void LightRenderComponent::draw(RenderTarget& target, RenderStates states) {
            lightMapTile->setCenter(target.getView().getPosition());
            states.blendMode = sf::BlendMultiply;
            target.draw(*lightMapTile, states);
        }
        View& LightRenderComponent::getView() {
            return view;
        }
        int LightRenderComponent::getLayer() {
            return getPosition().z;
        }
        void LightRenderComponent::updateParticleSystems() {
            /*for (unsigned int i = 0; i < visibleEntities.size(); i++) {
                if (dynamic_cast<physic::ParticleSystem*>(visibleEntities[i]) != nullptr) {
                    static_cast<physic::ParticleSystem*>(visibleEntities[i])->update();
                }
            }
            loadEntitiesOnComponent(visibleEntities);
            update = true;*/
        }
    }
}

Les valeurs RGBA de la texture de la normalMap sont à 0 dans le fragment shader "perPixLightingFragmentShader".

Le problème sous windows est que le compilateur c++ ne compile pas le projet hors que sous linux oui.
C'est dommage car je suis sûr que je n'aurais pas tout ces problèmes graphiques si le projet compilerait sous windows.

Dernière modification par Laurentdur (Le 29/12/2018, à 16:28)

Hors ligne

#3 Le 29/12/2018, à 17:18

GammaDraconis

Re : Installer une ancienne version d'un driver propriétaire sur ubuntu.

Contrairement à Nvidia, avec les cartes Ati, tu dois utiliser le pilote opensource sous linux (plus de pilote propriétaire depuis longtemps).

Dernière modification par GammaDraconis (Le 29/12/2018, à 17:19)


Discussion sur mon script de post-install pour Ubuntu 20.04LTS : https://forum.ubuntu-fr.org/viewtopic.php?id=2026344
Lien direct script : https://github.com/simbd/Ubuntu_20.04LTS_PostInstall
Démo vidéo (peertube) : https://video.ploud.fr/videos/watch/fb7 … 0d252ed2db

Hors ligne

#4 Le 07/04/2019, à 01:59

Laurentdur

Re : Installer une ancienne version d'un driver propriétaire sur ubuntu.

Il y a amd gpu pro mais il faut installer pleins de dépendance et je ne pense pas qu'il soit compatible.

Hors ligne