网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
float v0 = dot(color0.rgb, COEF_V) + 0.5;
float u0 = dot(color1.rgb, COEF_U) + 0.5;
float v1 = dot(color2.rgb, COEF_V) + 0.5;
float u1 = dot(color3.rgb, COEF_U) + 0.5;
outColor = vec4(v0, u0, v1, u1);
}
}
RGB2NV21.cpp
//
// Created by CreatWall_zhouwen on 2023/4/28.
//
#include <stdio.h>
#include “RGB2NV21.h”
#include “Util.h”
#include “GLUtil.h”
#include <malloc.h>
#include <string.h>
#include <unistd.h>
#include “sys/stat.h”
#include “stdint.h”
RGB2NV21* m_pContext = nullptr;
#define TAG “RGB2NV21”
//顶点坐标
GLfloat vVertices[] = {
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
};
//纹理坐标
GLfloat vFboTexCoors[] = {
0.0f, 0.0f,
1.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f,
};
GLushort indices[] = { 0, 1, 2, 1, 3, 2 };//三角形的索引数组
/*
*
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
//纹理坐标
GLfloat vFboTexCoors[] = {
0.0f, 1.0f,
1.0f, 1.0f,
0.0f, 0.0f,
1.0f, 0.0f,
};
GLushort indices[] = { 0, 1, 2, 1, 3, 2 };//三角形的索引数组
*/
RGB2NV21::RGB2NV21() {
m_FboVertexShader = GL_NONE;//FBO的顶点着色器和片段着色器
m_FboFragmentShader= GL_NONE;
m_FboProgramObj= GL_NONE;//FBO工程ID
m_ImageTextureId= GL_NONE;//图片数据的纹理ID
m_FboTextureId= GL_NONE;//FBO绑定的空数据纹理ID
m_FboSamplerLoc= GL_NONE;//FBO片段着色器中的采样器值的位置
m_Fbo