Qt-OpenGL-03 纹理Texture

2023-10-29

写在开头:文章是基于纹理 - LearnOpenGL CN 教程的学习记录,强烈建议在网站上先弄清楚原理再看此文章。以Qt-GL窗口代替GLFW的写法,Qt库中一些类代替教程中的类,一起入坑。

效果图:

上图使用了两纹理混合。接下来是一些比较重要的,使用glUniform1i,可以给纹理采样器分配一个位置值,这样的话我们能够在一个片段着色器中设置多个纹理。一个纹理的位置值通常称为一个纹理单元(Texture Unit)。一个纹理的默认纹理单元是0,它是默认的激活纹理单元,所以教程前面部分我们没有分配一个位置值。

纹理单元的主要目的是让我们在着色器中可以使用多于一个的纹理。通过把纹理单元赋值给采样器,我们可以一次绑定多个纹理,只要我们首先激活对应的纹理单元。就像glBindTexture一样,我们可以使用glActiveTexture激活纹理单元,传入我们需要使用的纹理单元:

如果有需要更多的纹理应当这样:
 

 //激活纹理单元0
 glActiveTexture(GL_TEXTURE0);
 m_combine_texture1->bind();
 //激活纹理单元1
 glActiveTexture(GL_TEXTURE1);
 m_combine_texture2->bind();

 OpenGL至少保证有16个纹理单元供你使用,也就是说你可以激活从GL_TEXTURE0到GL_TEXTRUE15。它们都是按顺序定义的,所以我们也可以通过GL_TEXTURE0 + 8的方式获得GL_TEXTURE8,这在当我们需要循环一些纹理单元的时候会很有用.

 不同于教程的地方:

用QOpenGLTexture代替stb_image.h

stb_image.h的写法:

glGenTextures(1, &texture2);
    glBindTexture(GL_TEXTURE_2D, texture2);
    // set the texture wrapping parameters
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);	// set texture wrapping to GL_REPEAT (default wrapping method)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    // set texture filtering parameters
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    // load image, create texture and generate mipmaps
    data = stbi_load(FileSystem::getPath("resources/textures/awesomeface.png").c_str(), &width, &height, &nrChannels, 0);
    if (data)
    {
        // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
        glGenerateMipmap(GL_TEXTURE_2D);
    }
    else
    {
        std::cout << "Failed to load texture" << std::endl;
    }

QOpenGLTexture的写法:

m_combine_texture2 = new QOpenGLTexture(QImage(":/texture/res/textures/awesomeface.png").mirrored());
    if(!m_combine_texture2->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_combine_texture2->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_combine_texture2->setMagnificationFilter(QOpenGLTexture::Linear);

主要代码:

#ifndef TEXTUREWIDGET_H
#define TEXTUREWIDGET_H

#include <QWidget>
#include <QOpenGLWidget>
#include <QOpenGLExtraFunctions>
#include <QDebug>
#include <QOpenGLTexture>
#include "Shader.h"

class HelloTexture;
namespace Ui {
class TextureWidget;
class QOpenGLTexture;
}

class TextureWidget : public QWidget
{
    Q_OBJECT

public:
    explicit TextureWidget(QWidget *parent = nullptr);
    ~TextureWidget();

private:
    Ui::TextureWidget *ui;
    HelloTexture *m_contentWidget;
};


class HelloTexture : public QOpenGLWidget,protected QOpenGLExtraFunctions
{

    enum TARGET_STATUS
    {
        Original,
        Combine,
        Exercise2,
        Exercise3,
        Exercise4
    };



public:
    HelloTexture();
    ~HelloTexture();

private:
    void InitOriginal();
    void InitCombine();
    void InitExercise2();
    void InitExercise3();
    void InitExercise4();

protected:
    virtual void initializeGL();
    virtual void resizeGL(int w, int h);
    virtual void paintGL();
private:
    TARGET_STATUS m_status;
    Shader *m_shader;
    QOpenGLTexture *m_texture;
    QOpenGLTexture *m_combine_texture1;
    QOpenGLTexture *m_combine_texture2;
};

#endif // TEXTUREWIDGET_H

cpp 

#include "texturewidget.h"
#include "ui_texturewidget.h"

#include <QImage>


TextureWidget::TextureWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TextureWidget)
{
    ui->setupUi(this);
    m_contentWidget = new HelloTexture();
    ui->verticalLayout->addWidget(m_contentWidget);
}

TextureWidget::~TextureWidget()
{
    delete ui;
}

static GLuint VBO, VAO, EBO = 0;
HelloTexture::HelloTexture()
{

}

HelloTexture::~HelloTexture()
{

}

void HelloTexture::InitOriginal()
{
    m_status = TARGET_STATUS::Original;
    m_shader = new Shader(":/shader/res/shaders/getting_started/4.1.texture.vs"
    ,":/shader/res/shaders/getting_started/4.1.texture.fs");

    //垂直镜像mirrored
    m_texture = new QOpenGLTexture(QImage(":/texture/res/textures/container.jpg").mirrored());
    if(!m_texture->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_texture->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_texture->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_texture->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_texture->setMagnificationFilter(QOpenGLTexture::Linear);
    //m_texture->setFormat(QOpenGLTexture::RGBFormat); //将纹理储存为rgb值
}

void HelloTexture::InitCombine()
{
    m_status = TARGET_STATUS::Combine;
    m_shader = new Shader(":/shader/res/shaders/getting_started/4.2.texture.vs"
    ,":/shader/res/shaders/getting_started/4.2.texture.fs");

    //垂直镜像mirrored
    m_combine_texture1 = new QOpenGLTexture(QImage(":/texture/res/textures/container.jpg").mirrored());
    if(!m_combine_texture1->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_combine_texture1->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_combine_texture1->setMagnificationFilter(QOpenGLTexture::Linear);


    m_combine_texture2 = new QOpenGLTexture(QImage(":/texture/res/textures/awesomeface.png").mirrored());
    if(!m_combine_texture2->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_combine_texture2->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_combine_texture2->setMagnificationFilter(QOpenGLTexture::Linear);

    //设置纹理单元编号
    m_shader->use();
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture1"), 0);
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture2"), 1);

}

void HelloTexture::InitExercise2()
{
    m_status = TARGET_STATUS::Exercise2;
    m_shader = new Shader(":/shader/res/shaders/getting_started/4.3.texture.vs"
    ,":/shader/res/shaders/getting_started/4.3.texture.fs");

    //垂直镜像mirrored
    m_combine_texture1 = new QOpenGLTexture(QImage(":/texture/res/textures/container.jpg").mirrored());
    if(!m_combine_texture1->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::ClampToEdge);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::ClampToEdge);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_combine_texture1->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_combine_texture1->setMagnificationFilter(QOpenGLTexture::Linear);


    m_combine_texture2 = new QOpenGLTexture(QImage(":/texture/res/textures/awesomeface.png").mirrored());
    if(!m_combine_texture2->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_combine_texture2->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_combine_texture2->setMagnificationFilter(QOpenGLTexture::Linear);

    //设置纹理单元编号
    m_shader->use();
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture1"), 0);
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture2"), 1);

}

void HelloTexture::InitExercise3()
{
    m_status = TARGET_STATUS::Exercise3;
    m_shader = new Shader(":/shader/res/shaders/getting_started/4.4.texture.vs"
    ,":/shader/res/shaders/getting_started/4.4.texture.fs");

    //垂直镜像mirrored
    m_combine_texture1 = new QOpenGLTexture(QImage(":/texture/res/textures/container.jpg").mirrored());
    if(!m_combine_texture1->isCreated()){
        qDebug() << "Failed to load texture";
    }
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::ClampToEdge);
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::ClampToEdge);

    m_combine_texture1->setMinificationFilter(QOpenGLTexture::Nearest);
    m_combine_texture1->setMagnificationFilter(QOpenGLTexture::Nearest);


    m_combine_texture2 = new QOpenGLTexture(QImage(":/texture/res/textures/awesomeface.png").mirrored());
    if(!m_combine_texture2->isCreated()){
        qDebug() << "Failed to load texture";
    }
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    m_combine_texture2->setMinificationFilter(QOpenGLTexture::Nearest);
    m_combine_texture2->setMagnificationFilter(QOpenGLTexture::Nearest);

    //设置纹理单元编号
    m_shader->use();
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture1"), 0);
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture2"), 1);
}

void HelloTexture::InitExercise4()
{
    m_status = TARGET_STATUS::Exercise4;
    m_shader = new Shader(":/shader/res/shaders/getting_started/4.5.texture.vs"
    ,":/shader/res/shaders/getting_started/4.5.texture.fs");

    //垂直镜像mirrored
    m_combine_texture1 = new QOpenGLTexture(QImage(":/texture/res/textures/container.jpg").mirrored());
    if(!m_combine_texture1->isCreated()){
        qDebug() << "Failed to load texture";
    }
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    m_combine_texture1->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    m_combine_texture1->setMinificationFilter(QOpenGLTexture::Linear);
    m_combine_texture1->setMagnificationFilter(QOpenGLTexture::Linear);


    m_combine_texture2 = new QOpenGLTexture(QImage(":/texture/res/textures/awesomeface.png").mirrored());
    if(!m_combine_texture2->isCreated()){
        qDebug() << "Failed to load texture";
    }
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionS, QOpenGLTexture::Repeat);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    m_combine_texture2->setWrapMode(QOpenGLTexture::DirectionT, QOpenGLTexture::Repeat);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    m_combine_texture2->setMinificationFilter(QOpenGLTexture::Linear);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    m_combine_texture2->setMagnificationFilter(QOpenGLTexture::Linear);

    //设置纹理单元编号
    m_shader->use();
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture1"), 0);
    m_shader->m_shaderProgram.setUniformValue(m_shader->m_shaderProgram.uniformLocation("texture2"), 1);
    //设置混合值
    m_shader->m_shaderProgram.setUniformValue("mixValue", 0.5f);
}

void HelloTexture::initializeGL()
{
    //初始化functions
    this->initializeOpenGLFunctions();

    //运行选项
    //InitOriginal();
    //InitCombine();
    //InitExercise2();
    //InitExercise3();
    InitExercise4();


    float ver[32];
    if(m_status == Exercise2)
    {
        float vertices[] = {
               // positions          // colors           // texture coords (note that we changed them to 2.0f!)
                0.5f,  0.5f, 0.0f,   1.0f, 0.0f, 0.0f,   2.0f, 2.0f, // top right
                0.5f, -0.5f, 0.0f,   0.0f, 1.0f, 0.0f,   2.0f, 0.0f, // bottom right
               -0.5f, -0.5f, 0.0f,   0.0f, 0.0f, 1.0f,   0.0f, 0.0f, // bottom left
               -0.5f,  0.5f, 0.0f,   1.0f, 1.0f, 0.0f,   0.0f, 2.0f  // top left
           };
        for(int i = 0 ; i < 32; i++)
        {
            ver[i] = vertices[i];
        }

    }
    else if(m_status == Exercise3)
    {
        float vertices[] = {
               // positions          // colors           // texture coords
            0.5f,  0.5f, 0.0f,   1.0f, 0.0f, 0.0f,   0.55f, 0.55f, // top right
            0.5f, -0.5f, 0.0f,   0.0f, 1.0f, 0.0f,   0.55f, 0.45f, // bottom right
            -0.5f, -0.5f, 0.0f,   0.0f, 0.0f, 1.0f,   0.45f, 0.45f, // bottom left
            -0.5f,  0.5f, 0.0f,   1.0f, 1.0f, 0.0f,   0.45f, 0.55f  // top left
           };
        for(int i = 0 ; i < 32; i++)
        {
            ver[i] = vertices[i];
        }
    }
    else
    {
        float vertices[] = {
            // positions          // colors           // texture coords
            0.5f,  0.5f, 0.0f,   1.0f, 0.0f, 0.0f,   1.0f, 1.0f, // top right
            0.5f, -0.5f, 0.0f,   0.0f, 1.0f, 0.0f,   1.0f, 0.0f, // bottom right
            -0.5f, -0.5f, 0.0f,   0.0f, 0.0f, 1.0f,   0.0f, 0.0f, // bottom left
            -0.5f,  0.5f, 0.0f,   1.0f, 1.0f, 0.0f,   0.0f, 1.0f  // top left
        };
        for(int i = 0 ; i < 32; i++)
        {
            ver[i] = vertices[i];
        }
    }


    unsigned int indices[] = {
        0, 1, 3, // first triangle
        1, 2, 3  // second triangle
    };

    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    glGenBuffers(1, &EBO);

    glBindVertexArray(VAO);

    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(ver), ver, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    // position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    // color attribute
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);
    // texture coord attribute
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);


}

void HelloTexture::resizeGL(int w, int h)
{
    glViewport(0,0,w,h);
}

void HelloTexture::paintGL()
{
    glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);


    if(m_status == Original)
    {
        m_texture->bind();
    }else
    {
        //激活纹理单元0
        glActiveTexture(GL_TEXTURE0);
        m_combine_texture1->bind();
        //激活纹理单元1
        glActiveTexture(GL_TEXTURE1);
        m_combine_texture2->bind();
    }

    // render container
    m_shader->use();
    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
}

下一篇:Qt-OpenGL-04 变换Transformations 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Qt-OpenGL-03 纹理Texture 的相关文章

随机推荐

  • LAMP系统构建论文

    毕业论文中文摘要 随着信息技术的不断发展 网络技术的不断完善 各种服务类平台层出不穷 在这样的环境下 Lamp系统架构应运而生了 并且经过不断的完善 俨然已成为国内外首屈一指的大型服务平台之一 Lamp Linux Apache MySQL
  • vue+阿里的G2图表-antv+折线图

    前言 之前使用的图表是echarts highcharts两个常用图表的 现在的话因为项目需要和别的原因也接触使用了阿里的g2图表 感觉效果还是挺好的 在这里分享下 官网入口 实现效果 实现步骤 第一 安装插件 npm install an
  • VS code 运行C/C++文件

    VS code 运行C C 文件 搞了一下午 搞得头疼 网上的教程五花八门 奈何VS code版本更新太快 于是 就出现了各种bug 就很难受 不过最终终于成功啦 所以做一个简短的小结 防止自己以后再装就忘了 第一步 下载mingw 这个直
  • 计算KL散度与JS散度的MATLAB程序-简单好用

    阅读目录 Content MATLAB小函数 计算KL散度与JS散度 1 MATLAB程序 2 结果 MATLAB程序 计算KL散度与JS散度 问题 给定两个向量 计算这两个向量之间的Kullback Leibler Divergence与
  • Unity之Animation窗口

    一 Animation窗口是用来干啥的 Animation窗口 直译就是动画窗口 它主要用于在Unity内部创建和修改动画 所有在场景中的对象都可以通过Animation窗口为其制作动画 二 打开Animation窗口 Window gt
  • Github上的十大机器学习项目

    原文作者 Matthew Mayo 译文地址 Top 10 Machine Learning Projects on Github 文章译者 赵屹华 搜狗计算广告工程师 前生物医学工程师 关注推荐算法 机器学习领域 文章审校 刘帝伟 Git
  • 学1个月爬虫就月赚6000?别被骗了,我来告诉你真实情况

    这是我前几天看到的一个真实事件 也是我写这篇文章的缘由 前几天有粉丝跟我反馈说 某机构的人跟他说学爬虫1个月就能接单 让这小伙子去报名那个机构的爬虫课程 学完之后1个月就能把6000多的学费赚回来 可能是因为我和粉丝的交流比较多 所以小伙子
  • 2.Python简介、特点、安装配置、pip包管理命令

    Python简介 Python 语言 语言 人与人之间交流需要语言 比如说汉语 英语 编程语言就是人与机器交流的语言 面向过程往面向对象的过渡 例 C C C sharp Java是面向对象 面向过程 面向过程可以认为是流程 一步一步操作
  • HMM隐马尔可夫模型进行中文文本分词

    文章目录 一 HMM简述 1 引入 2 隐马尔科夫模型 1 定义 Definition of a hidden Markov model 2 应用 3 前向算法 了解 4 维特比算法 5 前向 后向算法 了解 二 使用HMM进行文本分类 1
  • [Python系列-14]:人工智能 - 数学基础 -4- 数组元素的线性代数运算(向量、矩阵运算)

    作者主页 文火冰糖的硅基工坊 https blog csdn net HiWangWenBing 本文网址 https blog csdn net HiWangWenBing article details 119301224 目录 第1章
  • Configuring App Transport Security Exceptions in iOS 9 and OSX 10.11

    What is App Transport Security ATS At WWDC 2015 Apple announced App Transport Security for iOS 9 and OSX 10 11 El Capita
  • 聊一聊深度学习--包括计算前馈网络的反向传播和卷积的反向传播

    聊一聊深度学习 三天肝完深度学习基础 球球让我过吧 引言 人工智能领域的流派 机器学习流程 了解 表示学习 语义鸿沟 好的数据表示 语义表示 局部表示 分布式表示 学习过程 监督学习 有反馈 无监督学习 无反馈 强化学习 多步之后反馈 神经
  • h5跳转App以及URL Scheme获取-App协议列表

    从Safari跳到APP 跳转 既然要想跳到你指定的APP 那么就需要在你的APP中定义一个特殊的标示 也就是一个URL协议 定义URL协议的如下图 TARGETS gt info gt URL Types gt 添加一个URL协议 Sni
  • Shell脚本攻略:数组

    目录 一 理论 1 数组概述 2 定义数组 3 数组打印 4 数组的数据类型及处理 5 数组赋值 6 数组遍历 7 数组切片 8 数组替换 9 删除数组 10 追加数组中的元素 11 数组排序算法 二 实验 1 实验一 2 实验二 3 实验
  • PS的颜色选择--从英雄到坏蛋的15个配色方案

    从英雄到坏蛋的15个配色方案 故事IGEEK DESIGN 迪斯尼公司于1923成立 他们的第一部长片电影 白雪公主与七个小矮人于1937年发布 关于白雪公主有一个最有趣的地方 她是迪士尼世界中最能代表 善良 的角色 在故事中 邪恶的王后嫉
  • 消息队列mq总结

    转自 http blog csdn net konglongaa article details 52208273 http blog csdn net oMaverick1 article details 51331004 https y
  • Css实现省略号...及悬浮层显示全部内容的方法:

    1 单行文本省略 overflow hidden 溢出隐藏 white space nowrap 禁止换行 text overflow ellipsis 2 多行文本省略 display webkit box 谷歌 webkit box o
  • 软工UML画图

    学习如何画图 如类图 顺序图 流程图 E R图和类代码等 一个一个来 起始 数据流图 功能模型 基本符号 加工 命名要用动宾词组 外部实体 数据存储 数据流 命名要用名词 题目说明解法 下面用个题来说明 假设一家工厂的采购部每天需要一张定货
  • 微服务架构(Microservice Architecture)

    之前一段时间 有听部门架构说起接下来公司要使用微服务架构来研发系统 当时没怎么在意 因为是第一次听说微服务这个名词 果然无知者无畏啊 正好赶上五一假 我自告奋勇的 接了编写微服务架构培训文档这个任务 也许因为我是文科生 文笔稍微好点 五一假
  • Qt-OpenGL-03 纹理Texture

    写在开头 文章是基于纹理 LearnOpenGL CN 教程的学习记录 强烈建议在网站上先弄清楚原理再看此文章 以Qt GL窗口代替GLFW的写法 Qt库中一些类代替教程中的类 一起入坑 效果图 上图使用了两纹理混合 接下来是一些比较重要的