glBindAttribLocation

名称

glBindAttribLocation - 将通用顶点属性索引与命名属性变量相关联

C规范

void glBindAttribLocation(GLuint program,

                                                  GLuint index,

                                                  const GLchar *name);

参数

program

指定要在其中建立关联的程序对象的句柄。

index

指定要绑定的通用顶点属性的索引。

name

指定一个以空终止符结尾的字符串,其中包含要绑定索引的顶点着色器属性变量的名称。

描述

glBindAttribLocation用于将程序指定的程序对象中的用户定义属性变量与通用顶点属性索引相关联。用户定义的属性变量的名称作为名称中的空终止字符串传递。要绑定到此变量的通用顶点属性索引由index指定。当程序成为当前状态的一部分时,通过通用顶点属性索引提供的值将修改由name指定的用户定义属性变量的值。

如果name引用矩阵属性变量,则index引用矩阵的第一列。然后,对于mat2类型的矩阵,其他矩阵列自动绑定到位置index + 1; index + 1和index + 2表示mat3类型的矩阵;对于mat4类型的矩阵,index + 1,index + 2和index + 3。

此命令使顶点着色器可以使用属性变量的描述性名称,而不是编号为0到GL_MAX_VERTEX_ATTRIBS -1的泛型变量。发送到每个通用属性索引的值是当前状态的一部分,就像标准顶点属性(如颜色,法线和顶点位置)一样。如果通过调用glUseProgram使不同的程序对象成为当前的程序,则跟踪通用顶点属性,使得新程序对象中的属性也将观察到相同的值,这些属性也绑定到索引。

可以通过调用glBindAttribLocation随时显式分配程序对象的属性变量名称到通用属性索引绑定。在调用glLinkProgram之前,属性绑定不会生效。成功链接程序对象后,通用属性的索引值保持固定(并且可以查询它们的值),直到发生下一个链接命令。

不允许应用程序使用此命令绑定任何标准OpenGL顶点属性,因为它们在需要时自动绑定。在程序对象链接之后发生的任何属性绑定在下次链接程序对象之前不会生效。

注意

可以在任何顶点着色器对象绑定到指定程序对象之前调用glBindAttribLocation。也允许将通用属性索引绑定到从未在顶点着色器中使用的属性变量名称。

如果以前绑定了name,则该信息将丢失。因此,您不能将一个用户定义的属性变量绑定到多个索引,但您可以将多个用户定义的属性变量绑定到同一索引。

允许应用程序将多个用户定义的属性变量绑定到相同的通用顶点属性索引。这称为aliasing(别名),仅当可执行程序中只有一个别名属性处于活动状态时,或者如果没有通过着色器的路径消耗属于同一位置的一组属性的多个属性时,才允许使用别名。允许编译器和链接器假定没有进行别名,并且可以自由地使用仅在没有别名的情况下工作的优化。不需要OpenGL实现来进行错误检查以检测别名。由于无法绑定标准属性,因此无法使用常规属性对通用属性进行别名(通用属性0除外)。

调用glLinkProgram时,链接器将绑定未显式绑定的活动属性。可以通过调用glGetAttribLocation来查询分配的位置。

调用glBindAttribLocation时,OpenGL会复制名称字符串,因此应用程序可以在函数返回后立即释放其名称字符串的副本。

错误

GL_INVALID_VALUEindex>=GL_MAX_VERTEX_ATTRIBS

GL_INVALID_OPERATIONname以保留前缀“gl_”开头

GL_INVALID_VALUEprogram不是OpenGL生成的值

GL_INVALID_OPERATIONprogram不是程序对象

#include "DisplayHandler.h" //加入三维顶点数据 两个三角形组成正方形 const float vers[] = { 1.0f, -1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f, -1.0f, 1.0f, 0.0f, }; //加入材质坐标数据 const float txts[] = { 1.0f, 0.0f,//右下 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f }; #define GET_STR(x) #x //顶点着色器 glsl static const char *vertexShader = GET_STR( attribute vec4 aPosition;//顶点坐标 attribute vec2 aTexCoord;//材质顶点坐标 varying vec2 vTexCoord;//输出的材质坐标 输出给片元着色器 void main() { vTexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y); gl_Position = aPosition;//显示顶点 } ); //片元着色器 NV12 // // glsl static const char *fragYUV = GET_STR( precision mediump float;//精度 varying vec2 vTexCoord;//顶点着色器传递的坐标 uniform sampler2D yTexture;//输入材质参数(不透明灰度,单像素) uniform sampler2D uvTexture;//输入材质参数 void main() { vec3 yuv; vec3 rgb; yuv.r = texture2D(yTexture, vTexCoord).r; yuv.g = texture2D(uvTexture, vTexCoord).r - 0.5; yuv.b = texture2D(uvTexture, vTexCoord).a - 0.5; rgb = mat3(1.0, 1.0, 1.0, 0.0, 0.39465, 2.03211, 1.13983, -0.5806, 0.0) * yuv; //输出像素颜色 gl_FragColor = vec4(rgb, 1.0); } ); DisplayHandler::DisplayHandler() { videoWidth = 1920; videoHeight = 1080; glProgram = 0; eglSurface = nullptr; eglContext = nullptr; eglDisplay = nullptr; } bool DisplayHandler::initEGL(EGLNativeWindowType *nwin) { //EGL //1 eglDisplay 显示 eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (eglDisplay == EGL_NO_DISPLAY) { printf("get eglDisplay failed!"); return false; } //初始化 后面两个参数是版本号 if (EGL_TRUE != eglInitialize(eglDisplay, 0, 0)) { printf("eglInitialize failed!"); return false; } //2 surface (关联原始窗口) //surface 配置 //输出配置 EGLConfig config; EGLint configNum; //输入配置 EGLint configSpec[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_NONE }; if (EGL_TRUE != eglChooseConfig(eglDisplay, configSpec, &config, 1, &configNum)) { printf("eglChooseConfig failed!"); return false; } //创建surface (关联原始窗口) eglSurface = eglCreateWindowSurface(eglDisplay, config, nwin, 0); if (eglSurface == EGL_NO_SURFACE) { printf("eglCreateWindowSurface failed!"); return false; } //3 context 创建关联上下文 const EGLint ctxAttr[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; eglContext = eglCreateContext(eglDisplay, config, EGL_NO_CONTEXT, ctxAttr); if (eglContext == EGL_NO_CONTEXT) { printf("eglCreateContext failed!"); return false; } //egl 关联 openGL if (EGL_TRUE != eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) { printf("eglMakeCurrent failed!"); return false; } printf("EGL init success"); return true; } void DisplayHandler::deinitEGL() { EGLBoolean success; if (eglDisplay != nullptr && eglSurface != nullptr) { success = eglDestroySurface(eglDisplay, eglSurface); if (!success) { printf("eglDestroySurface failure."); } eglSurface = nullptr; } if (eglDisplay != nullptr && eglContext != nullptr) { success = eglDestroyContext(eglDisplay, eglContext); if (!success) { printf("eglDestroyContext failure."); } eglContext = nullptr; success = eglTerminate(eglDisplay); if (!success) { printf("eglTerminate failure."); } eglDisplay = nullptr; } if (glProgram != 0) { glDeleteProgram(glProgram); glProgram = 0; } } //初始化着色器 GLint DisplayHandler::initShader(const char *code, GLint type) { GLuint shader; GLint compiled; // Create an empty shader object, which maintain the source code strings that define a shader shader = glCreateShader(type); if (shader == 0) { return 0; } // Replaces the source code in a shader object glShaderSource(shader, 1, &code, nullptr); // Compile the shader object glCompileShader(shader); // Check the shader object compile status glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint infoLen = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); if (infoLen > 1) { GLchar *infoLog = (GLchar *) malloc(sizeof(GLchar) * infoLen); glGetShaderInfoLog(shader, infoLen, nullptr, infoLog); printf("Error compiling shader:\n%s\n", infoLog); free(infoLog); } glDeleteShader(shader); return 0; } return shader; } GLuint DisplayHandler::loadProgram(const char *vShaderStr, const char *fShaderStr) { GLuint vertexShader; GLuint fragmentShader; GLuint programObject; GLint linked; // Load the vertex/fragment shaders vertexShader = initShader(vShaderStr, GL_VERTEX_SHADER); fragmentShader = initShader(fShaderStr, GL_FRAGMENT_SHADER); // Create the program object programObject = glCreateProgram(); if (programObject == 0) { return 0; } // Attaches a shader object to a program object glAttachShader(programObject, vertexShader); glAttachShader(programObject, fragmentShader); // Bind vPosition to attribute 0 glBindAttribLocation(programObject, 0, "vPosition"); // Link the program object glLinkProgram(programObject); // Check the link status glGetProgramiv(programObject, GL_LINK_STATUS, &linked); if (!linked) { GLint infoLen = 0; glGetProgramiv(programObject, GL_INFO_LOG_LENGTH, &infoLen); if (infoLen > 1) { GLchar *infoLog = (GLchar *) malloc(sizeof(GLchar) * infoLen); glGetProgramInfoLog(programObject, infoLen, NULL, infoLog); printf("Error linking program:\n%s\n", infoLog); free(infoLog); } glDeleteProgram(programObject); return GL_FALSE; } // Free no longer needed shader resources glDeleteShader(vertexShader); glDeleteShader(fragmentShader); return programObject; } GLint DisplayHandler::createProgram() { GLuint programObject; // Load the shaders and get a linked program object programObject = loadProgram((const char *) vertexShader, (const char *) fragYUV); if (programObject == 0) { return GL_FALSE; } // Store the program object glProgram = programObject; glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glGenTextures(TEXTURE_NUM, mTextureID); for (int i = 0; i < TEXTURE_NUM; i++) { glBindTexture(GL_TEXTURE_2D, mTextureID[i]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } //激活渲染程序 glUseProgram(glProgram); //获取shader中的顶点变量 GLuint apos = (GLuint) glGetAttribLocation(glProgram, "aPosition"); glEnableVertexAttribArray(apos); //传递顶点 /* * apos 传到哪 * 每一个点有多少个数据 * 格式 * 是否有法线向量 * 一个数据的偏移量 * 12 顶点有三个值(x,y,z)float存储 每个有4个字节 每一个值的间隔是 3*4 = 12 * ver 顶点数据 * */ glVertexAttribPointer(apos, 3, GL_FLOAT, GL_FALSE, 12, vers); GLuint atex = (GLuint) glGetAttribLocation(glProgram, "aTexCoord"); glEnableVertexAttribArray(atex); glVertexAttribPointer(atex, 2, GL_FLOAT, GL_FLOAT, 8, txts); //设置纹理层 glUniform1i(glGetUniformLocation(glProgram, "yTexture"), 0);//对于纹理第1层 glUniform1i(glGetUniformLocation(glProgram, "uvTexture"), 1);//对于纹理第2层 return 0; } void DisplayHandler::setVideoWH(int width, int height) { videoWidth = width; videoHeight = height; } int DisplayHandler::getVideoWidth() const { return videoWidth; } int DisplayHandler::getVideoHeight() const { return videoHeight; } void DisplayHandler::update(unsigned char *yuvBuf) { glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, mTextureID[0]);//绑定纹理,下面的属性针对这个纹理设置 //设置纹理的格式和大小 /* * GL_TEXTURE_2D * 显示细节的级别 * 内部gpu 格式 亮度 灰度图 * 宽 * 高 * 边框 * 数据的像素格式 * 像素的数据类型 * 纹理数据 * */ glTexImage2D(GL_TEXTURE_2D, 0,//默认 GL_LUMINANCE, videoWidth, videoHeight, //尺寸要是2的次方 拉伸到全屏 0, GL_LUMINANCE,//数据的像素格式,要与上面一致 GL_UNSIGNED_BYTE,// 像素的数据类型 yuvBuf ); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, mTextureID[1]); glTexImage2D(GL_TEXTURE_2D, 0,//默认 GL_LUMINANCE_ALPHA, videoWidth / 2, videoHeight / 2, //尺寸要是2的次方 拉伸到全屏 0, GL_LUMINANCE_ALPHA,//数据的像素格式,要与上面一致 GL_UNSIGNED_BYTE,// 像素的数据类型 yuvBuf + (videoWidth * videoHeight) ); //三维绘制 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);//从0顶点开始 一共4个顶点 //窗口显示 eglSwapBuffers(eglDisplay, eglSurface);//交换buf } 上述代码是正确,在main函数如何调用
最新发布
07-13
make [ 25%] Building CXX object CMakeFiles/lidar2camera.dir/src/run_avm.cpp.o In file included from /usr/local/include/pangolin/gl/gl.h:324, from /usr/local/include/pangolin/handler/handler.h:31, from /usr/local/include/pangolin/display/widgets.h:32, from /usr/local/include/pangolin/pangolin.h:40, from /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:8: /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlTexture::CopyFrom(const pangolin::GlTexture&)’: /usr/local/include/pangolin/gl/gl.hpp:350:5: error: ‘glCopyImageSubDataNV’ was not declared in this scope 350 | glCopyImageSubDataNV(tex.tid, GL_TEXTURE_2D, 0, 0, 0, 0, | ^~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlRenderBuffer::Reinitialise(GLint, GLint, GLint)’: /usr/local/include/pangolin/gl/gl.hpp:524:9: error: ‘glDeleteRenderbuffersEXT’ was not declared in this scope 524 | glDeleteRenderbuffersEXT(1, &rbid); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp:529:5: error: ‘glGenRenderbuffers’ was not declared in this scope; did you mean ‘GlRenderBuffer’? 529 | glGenRenderbuffers(1, &rbid); | ^~~~~~~~~~~~~~~~~~ | GlRenderBuffer /usr/local/include/pangolin/gl/gl.hpp:530:5: error: ‘glBindRenderbuffer’ was not declared in this scope; did you mean ‘GlRenderBuffer’? 530 | glBindRenderbuffer(GL_RENDERBUFFER_EXT, rbid); | ^~~~~~~~~~~~~~~~~~ | GlRenderBuffer /usr/local/include/pangolin/gl/gl.hpp:531:5: error: ‘glRenderbufferStorage’ was not declared in this scope 531 | glRenderbufferStorage(GL_RENDERBUFFER_EXT, internal_format, width, height); | ^~~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In destructor ‘pangolin::GlRenderBuffer::~GlRenderBuffer()’: /usr/local/include/pangolin/gl/gl.hpp:538:9: error: ‘glDeleteRenderbuffers’ was not declared in this scope 538 | glDeleteRenderbuffers(1, &rbid); | ^~~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In destructor ‘pangolin::GlFramebuffer::~GlFramebuffer()’: /usr/local/include/pangolin/gl/gl.hpp:587:9: error: ‘glDeleteFramebuffers’ was not declared in this scope 587 | glDeleteFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In constructor ‘pangolin::GlFramebuffer::GlFramebuffer(pangolin::GlTexture&)’: /usr/local/include/pangolin/gl/gl.hpp:594:5: error: ‘glGenFramebuffers’ was not declared in this scope; did you mean ‘GlFramebuffer’? 594 | glGenFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In constructor ‘pangolin::GlFramebuffer::GlFramebuffer(pangolin::GlTexture&, pangolin::GlRenderBuffer&)’: /usr/local/include/pangolin/gl/gl.hpp:602:5: error: ‘glGenFramebuffers’ was not declared in this scope; did you mean ‘GlFramebuffer’? 602 | glGenFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In constructor ‘pangolin::GlFramebuffer::GlFramebuffer(pangolin::GlTexture&, pangolin::GlTexture&, pangolin::GlRenderBuffer&)’: /usr/local/include/pangolin/gl/gl.hpp:611:5: error: ‘glGenFramebuffers’ was not declared in this scope; did you mean ‘GlFramebuffer’? 611 | glGenFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In constructor ‘pangolin::GlFramebuffer::GlFramebuffer(pangolin::GlTexture&, pangolin::GlTexture&, pangolin::GlTexture&, pangolin::GlRenderBuffer&)’: /usr/local/include/pangolin/gl/gl.hpp:621:5: error: ‘glGenFramebuffers’ was not declared in this scope; did you mean ‘GlFramebuffer’? 621 | glGenFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In constructor ‘pangolin::GlFramebuffer::GlFramebuffer(pangolin::GlTexture&, pangolin::GlTexture&, pangolin::GlTexture&, pangolin::GlTexture&, pangolin::GlRenderBuffer&)’: /usr/local/include/pangolin/gl/gl.hpp:632:5: error: ‘glGenFramebuffers’ was not declared in this scope; did you mean ‘GlFramebuffer’? 632 | glGenFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlFramebuffer::Bind() const’: /usr/local/include/pangolin/gl/gl.hpp:643:5: error: ‘glBindFramebuffer’ was not declared in this scope; did you mean ‘GlFramebuffer’? 643 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp:644:5: error: ‘glDrawBuffers’ was not declared in this scope; did you mean ‘glDrawBuffer’? 644 | glDrawBuffers( attachments, attachment_buffers ); | ^~~~~~~~~~~~~ | glDrawBuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlFramebuffer::Reinitialise()’: /usr/local/include/pangolin/gl/gl.hpp:650:9: error: ‘glDeleteFramebuffers’ was not declared in this scope 650 | glDeleteFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp:652:5: error: ‘glGenFramebuffers’ was not declared in this scope; did you mean ‘GlFramebuffer’? 652 | glGenFramebuffers(1, &fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlFramebuffer::Unbind() const’: /usr/local/include/pangolin/gl/gl.hpp:657:5: error: ‘glDrawBuffers’ was not declared in this scope; did you mean ‘glDrawBuffer’? 657 | glDrawBuffers( 1, attachment_buffers ); | ^~~~~~~~~~~~~ | glDrawBuffer /usr/local/include/pangolin/gl/gl.hpp:658:5: error: ‘glBindFramebuffer’ was not declared in this scope; did you mean ‘GlFramebuffer’? 658 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘GLenum pangolin::GlFramebuffer::AttachColour(pangolin::GlTexture&)’: /usr/local/include/pangolin/gl/gl.hpp:666:5: error: ‘glBindFramebuffer’ was not declared in this scope; did you mean ‘GlFramebuffer’? 666 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp:667:5: error: ‘glFramebufferTexture2D’ was not declared in this scope 667 | glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, color_attachment, GL_TEXTURE_2D, tex.tid, 0); | ^~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlFramebuffer::AttachDepth(pangolin::GlRenderBuffer&)’: /usr/local/include/pangolin/gl/gl.hpp:678:5: error: ‘glBindFramebuffer’ was not declared in this scope; did you mean ‘GlFramebuffer’? 678 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbid); | ^~~~~~~~~~~~~~~~~ | GlFramebuffer /usr/local/include/pangolin/gl/gl.hpp:680:5: error: ‘glFramebufferRenderbuffer’ was not declared in this scope 680 | glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb.rbid); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBufferData::Free()’: /usr/local/include/pangolin/gl/gl.hpp:736:9: error: ‘glDeleteBuffers’ was not declared in this scope; did you mean ‘glSelectBuffer’? 736 | glDeleteBuffers(1, &bo); | ^~~~~~~~~~~~~~~ | glSelectBuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBufferData::Reinitialise(pangolin::GlBufferType, GLsizeiptr, GLenum, const void*)’: /usr/local/include/pangolin/gl/gl.hpp:753:9: error: ‘glGenBuffers’ was not declared in this scope; did you mean ‘glReadBuffer’? 753 | glGenBuffers(1, &bo); | ^~~~~~~~~~~~ | glReadBuffer /usr/local/include/pangolin/gl/gl.hpp:761:5: error: ‘glBufferData’ was not declared in this scope; did you mean ‘GlBufferData’? 761 | glBufferData(buffer_type, size_bytes, data, gluse); | ^~~~~~~~~~~~ | GlBufferData /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBufferData::Bind() const’: /usr/local/include/pangolin/gl/gl.hpp:767:5: error: ‘glBindBuffer’ was not declared in this scope; did you mean ‘glReadBuffer’? 767 | glBindBuffer(buffer_type, bo); | ^~~~~~~~~~~~ | glReadBuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBufferData::Unbind() const’: /usr/local/include/pangolin/gl/gl.hpp:772:5: error: ‘glBindBuffer’ was not declared in this scope; did you mean ‘glReadBuffer’? 772 | glBindBuffer(buffer_type, 0); | ^~~~~~~~~~~~ | glReadBuffer /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBufferData::Upload(const GLvoid*, GLsizeiptr, GLintptr)’: /usr/local/include/pangolin/gl/gl.hpp:782:5: error: ‘glBufferSubData’ was not declared in this scope; did you mean ‘GlBufferData’? 782 | glBufferSubData(buffer_type,offset,size_bytes,data); | ^~~~~~~~~~~~~~~ | GlBufferData /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBufferData::Download(GLvoid*, GLsizeiptr, GLintptr) const’: /usr/local/include/pangolin/gl/gl.hpp:789:5: error: ‘glGetBufferSubData’ was not declared in this scope; did you mean ‘GlBufferData’? 789 | glGetBufferSubData(buffer_type, offset, size_bytes, data); | ^~~~~~~~~~~~~~~~~~ | GlBufferData /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlBuffer::Resize(GLuint)’: /usr/local/include/pangolin/gl/gl.hpp:864:9: error: ‘glGetBufferSubData’ was not declared in this scope; did you mean ‘GlBufferData’? 864 | glGetBufferSubData(buffer_type, 0, backup_size_bytes, backup); | ^~~~~~~~~~~~~~~~~~ | GlBufferData /usr/local/include/pangolin/gl/gl.hpp:865:9: error: ‘glBufferData’ was not declared in this scope; did you mean ‘GlBufferData’? 865 | glBufferData(buffer_type, new_num_elements*GlDataTypeBytes(datatype)*count_per_element, 0, gluse); | ^~~~~~~~~~~~ | GlBufferData /usr/local/include/pangolin/gl/gl.hpp:866:9: error: ‘glBufferSubData’ was not declared in this scope; did you mean ‘GlBufferData’? 866 | glBufferSubData(buffer_type, 0, backup_size_bytes, backup); | ^~~~~~~~~~~~~~~ | GlBufferData /usr/local/include/pangolin/gl/gl.hpp: In constructor ‘pangolin::GlVertexArrayObject::GlVertexArrayObject()’: /usr/local/include/pangolin/gl/gl.hpp:971:5: error: ‘glGenVertexArrays’ was not declared in this scope 971 | glGenVertexArrays(1, &vao); | ^~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In destructor ‘pangolin::GlVertexArrayObject::~GlVertexArrayObject()’: /usr/local/include/pangolin/gl/gl.hpp:976:5: error: ‘glDeleteVertexArrays’ was not declared in this scope 976 | glDeleteVertexArrays(1, &vao); | ^~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlVertexArrayObject::Bind() const’: /usr/local/include/pangolin/gl/gl.hpp:981:5: error: ‘glBindVertexArray’ was not declared in this scope 981 | glBindVertexArray(vao); | ^~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlVertexArrayObject::Unbind() const’: /usr/local/include/pangolin/gl/gl.hpp:987:5: error: ‘glBindVertexArray’ was not declared in this scope 987 | glBindVertexArray(0); | ^~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlVertexArrayObject::AddVertexAttrib(GLuint, const pangolin::GlBuffer&, size_t, size_t, GLboolean)’: /usr/local/include/pangolin/gl/gl.hpp:995:5: error: ‘glVertexAttribPointer’ was not declared in this scope; did you mean ‘glVertexPointer’? 995 | glVertexAttribPointer(attrib_location, bo.count_per_element, bo.datatype, normalized, stride_bytes, (void*)offset_bytes); | ^~~~~~~~~~~~~~~~~~~~~ | glVertexPointer /usr/local/include/pangolin/gl/gl.hpp:997:5: error: ‘glEnableVertexAttribArray’ was not declared in this scope 997 | glEnableVertexAttribArray(attrib_location); | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/pangolin/gl/glsl.h:232, from /usr/local/include/pangolin/plot/plotter.h:37, from /usr/local/include/pangolin/pangolin.h:48, from /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:8: /usr/local/include/pangolin/gl/glsl.hpp: In function ‘bool pangolin::IsLinkSuccessPrintLog(GLhandleARB)’: /usr/local/include/pangolin/gl/glsl.hpp:19:5: error: ‘glGetProgramiv’ was not declared in this scope 19 | glGetProgramiv(prog, GL_LINK_STATUS, &status); | ^~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp:25:9: error: ‘glGetProgramInfoLog’ was not declared in this scope 25 | glGetProgramInfoLog(prog, PROGRAM_LOG_MAX_LEN, &len, infolog); | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/local/include/pangolin/gl/glsl.h:232, from /usr/local/include/pangolin/plot/plotter.h:37, from /usr/local/include/pangolin/pangolin.h:48, from /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:8: /usr/local/include/pangolin/gl/glsl.hpp: In function ‘bool pangolin::IsCompileSuccessPrintLog(GLhandleARB, const string&, const string&)’: /usr/local/include/pangolin/gl/glsl.hpp:51:5: error: ‘glGetShaderiv’ was not declared in this scope 51 | glGetShaderiv(shader, GL_COMPILE_STATUS, &status); | ^~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp:57:9: error: ‘glGetShaderInfoLog’ was not declared in this scope 57 | glGetShaderInfoLog(shader, SHADER_LOG_MAX_LEN, &len, infolog); | ^~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In destructor ‘pangolin::GlSlProgram::~GlSlProgram()’: /usr/local/include/pangolin/gl/glsl.hpp:88:9: error: ‘glDeleteProgram’ was not declared in this scope; did you mean ‘GlSlProgram’? 88 | glDeleteProgram(prog); | ^~~~~~~~~~~~~~~ | GlSlProgram /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘bool pangolin::GlSlProgram::AddPreprocessedShader(pangolin::GlSlShaderType, const string&, const string&)’: /usr/local/include/pangolin/gl/glsl.hpp:108:16: error: ‘glCreateProgram’ was not declared in this scope 108 | prog = glCreateProgram(); | ^~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp:111:26: error: ‘glCreateShader’ was not declared in this scope; did you mean ‘GlSlVertexShader’? 111 | GLhandleARB shader = glCreateShader(shader_type); | ^~~~~~~~~~~~~~ | GlSlVertexShader /usr/local/include/pangolin/gl/glsl.hpp:113:5: error: ‘glShaderSource’ was not declared in this scope 113 | glShaderSource(shader, 1, &source, NULL); | ^~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp:114:5: error: ‘glCompileShader’ was not declared in this scope; did you mean ‘GlSlComputeShader’? 114 | glCompileShader(shader); | ^~~~~~~~~~~~~~~ | GlSlComputeShader /usr/local/include/pangolin/gl/glsl.hpp:117:9: error: ‘glAttachShader’ was not declared in this scope 117 | glAttachShader(prog, shader); | ^~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::ClearShaders()’: /usr/local/include/pangolin/gl/glsl.hpp:229:9: error: ‘glDetachShader’ was not declared in this scope 229 | glDetachShader(prog, shaders[i]); | ^~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp:230:9: error: ‘glDeleteShader’ was not declared in this scope; did you mean ‘GlSlVertexShader’? 230 | glDeleteShader(shaders[i]); | ^~~~~~~~~~~~~~ | GlSlVertexShader /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘bool pangolin::GlSlProgram::Link()’: /usr/local/include/pangolin/gl/glsl.hpp:365:5: error: ‘glLinkProgram’ was not declared in this scope; did you mean ‘GlSlProgram’? 365 | glLinkProgram(prog); | ^~~~~~~~~~~~~ | GlSlProgram /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::Bind()’: /usr/local/include/pangolin/gl/glsl.hpp:372:5: error: ‘glUseProgram’ was not declared in this scope; did you mean ‘GlSlProgram’? 372 | glUseProgram(prog); | ^~~~~~~~~~~~ | GlSlProgram /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SaveBind()’: /usr/local/include/pangolin/gl/glsl.hpp:378:5: error: ‘glUseProgram’ was not declared in this scope; did you mean ‘GlSlProgram’? 378 | glUseProgram(prog); | ^~~~~~~~~~~~ | GlSlProgram /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::Unbind()’: /usr/local/include/pangolin/gl/glsl.hpp:383:5: error: ‘glUseProgram’ was not declared in this scope; did you mean ‘GlSlProgram’? 383 | glUseProgram(prev_prog); | ^~~~~~~~~~~~ | GlSlProgram /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘GLint pangolin::GlSlProgram::GetAttributeHandle(const string&)’: /usr/local/include/pangolin/gl/glsl.hpp:388:20: error: ‘glGetAttribLocation’ was not declared in this scope 388 | GLint handle = glGetAttribLocation(prog, name.c_str()); | ^~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘GLint pangolin::GlSlProgram::GetUniformHandle(const string&)’: /usr/local/include/pangolin/gl/glsl.hpp:395:20: error: ‘glGetUniformLocation’ was not declared in this scope 395 | GLint handle = glGetUniformLocation(prog, name.c_str()); | ^~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, int)’: /usr/local/include/pangolin/gl/glsl.hpp:402:5: error: ‘glUniform1i’ was not declared in this scope 402 | glUniform1i( GetUniformHandle(name), x); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, int, int)’: /usr/local/include/pangolin/gl/glsl.hpp:407:5: error: ‘glUniform2i’ was not declared in this scope 407 | glUniform2i( GetUniformHandle(name), x1, x2); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, int, int, int)’: /usr/local/include/pangolin/gl/glsl.hpp:412:5: error: ‘glUniform3i’ was not declared in this scope 412 | glUniform3i( GetUniformHandle(name), x1, x2, x3); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, int, int, int, int)’: /usr/local/include/pangolin/gl/glsl.hpp:417:5: error: ‘glUniform4i’ was not declared in this scope 417 | glUniform4i( GetUniformHandle(name), x1, x2, x3, x4); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, float)’: /usr/local/include/pangolin/gl/glsl.hpp:422:5: error: ‘glUniform1f’ was not declared in this scope 422 | glUniform1f( GetUniformHandle(name), f); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, float, float)’: /usr/local/include/pangolin/gl/glsl.hpp:427:5: error: ‘glUniform2f’ was not declared in this scope 427 | glUniform2f( GetUniformHandle(name), f1,f2); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, float, float, float)’: /usr/local/include/pangolin/gl/glsl.hpp:432:5: error: ‘glUniform3f’ was not declared in this scope 432 | glUniform3f( GetUniformHandle(name), f1,f2,f3); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, float, float, float, float)’: /usr/local/include/pangolin/gl/glsl.hpp:437:5: error: ‘glUniform4f’ was not declared in this scope 437 | glUniform4f( GetUniformHandle(name), f1,f2,f3,f4); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, double)’: /usr/local/include/pangolin/gl/glsl.hpp:442:5: error: ‘glUniform1d’ was not declared in this scope 442 | glUniform1d( GetUniformHandle(name), f); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, double, double)’: /usr/local/include/pangolin/gl/glsl.hpp:447:5: error: ‘glUniform2d’ was not declared in this scope 447 | glUniform2d( GetUniformHandle(name), f1,f2); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, double, double, double)’: /usr/local/include/pangolin/gl/glsl.hpp:452:5: error: ‘glUniform3d’ was not declared in this scope 452 | glUniform3d( GetUniformHandle(name), f1,f2,f3); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, double, double, double, double)’: /usr/local/include/pangolin/gl/glsl.hpp:457:5: error: ‘glUniform4d’ was not declared in this scope 457 | glUniform4d( GetUniformHandle(name), f1,f2,f3,f4); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, pangolin::Colour)’: /usr/local/include/pangolin/gl/glsl.hpp:462:5: error: ‘glUniform4f’ was not declared in this scope 462 | glUniform4f( GetUniformHandle(name), c.r, c.g, c.b, c.a); | ^~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetUniform(const string&, const pangolin::OpenGlMatrix&)’: /usr/local/include/pangolin/gl/glsl.hpp:472:5: error: ‘glUniformMatrix4fv’ was not declared in this scope 472 | glUniformMatrix4fv( GetUniformHandle(name), 1, GL_FALSE, m); | ^~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::BindPangolinDefaultAttribLocationsAndLink()’: /usr/local/include/pangolin/gl/glsl.hpp:529:5: error: ‘glBindAttribLocation’ was not declared in this scope 529 | glBindAttribLocation(prog, DEFAULT_LOCATION_POSITION, DEFAULT_NAME_POSITION); | ^~~~~~~~~~~~~~~~~~~~ /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘GLint pangolin::GlSlProgram::GetProgramResourceIndex(const string&)’: /usr/local/include/pangolin/gl/glsl.hpp:539:12: error: ‘glGetProgramResourceIndex’ was not declared in this scope; did you mean ‘GetProgramResourceIndex’? 539 | return glGetProgramResourceIndex(prog, GL_SHADER_STORAGE_BLOCK, name.c_str()); | ^~~~~~~~~~~~~~~~~~~~~~~~~ | GetProgramResourceIndex /usr/local/include/pangolin/gl/glsl.hpp: In member function ‘void pangolin::GlSlProgram::SetShaderStorageBlock(const string&, const int&)’: /usr/local/include/pangolin/gl/glsl.hpp:544:5: error: ‘glShaderStorageBlockBinding’ was not declared in this scope 544 | glShaderStorageBlockBinding(prog, GetProgramResourceIndex(name), bindingIndex); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp: In function ‘void world2cam(double*, double*, Eigen::Matrix3d, std::vector<double, std::allocator<double> >)’: /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:62:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<double, std::allocator<double> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 62 | for (i = 1; i < D.size(); i++) { | ~~^~~~~~~~~~ /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp: In function ‘void CalibrationInit(std::vector<Eigen::Matrix<double, 4, 4> >)’: /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:216:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Eigen::Matrix<double, 4, 4> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 216 | for (int i = 0; i < json_param.size(); i++) { | ~~^~~~~~~~~~~~~~~~~~~ /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:225:24: error: ‘AngleAxisd’ is not a member of ‘Eigen’; did you mean ‘AngleAxis’? 225 | rot_tmp = Eigen::AngleAxisd(transform_flag[0] * cali_scale_degree_ / | ^~~~~~~~~~ | AngleAxis /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:228:24: error: ‘AngleAxisd’ is not a member of ‘Eigen’; did you mean ‘AngleAxis’? 228 | Eigen::AngleAxisd(transform_flag[1] * cali_scale_degree_ / | ^~~~~~~~~~ | AngleAxis /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:231:24: error: ‘AngleAxisd’ is not a member of ‘Eigen’; did you mean ‘AngleAxis’? 231 | Eigen::AngleAxisd(transform_flag[2] * cali_scale_degree_ / | ^~~~~~~~~~ | AngleAxis /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp: In function ‘void CalibrationScaleChange(int)’: /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:255:16: error: ‘AngleAxisd’ is not a member of ‘Eigen’; did you mean ‘AngleAxis’? 255 | Eigen::AngleAxisd(transform_flag[0] * cali_scale_degree_ / 180.0 * M_PI, | ^~~~~~~~~~ | AngleAxis /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:257:16: error: ‘AngleAxisd’ is not a member of ‘Eigen’; did you mean ‘AngleAxis’? 257 | Eigen::AngleAxisd(transform_flag[1] * cali_scale_degree_ / 180.0 * M_PI, | ^~~~~~~~~~ | AngleAxis /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:259:16: error: ‘AngleAxisd’ is not a member of ‘Eigen’; did you mean ‘AngleAxis’? 259 | Eigen::AngleAxisd(transform_flag[2] * cali_scale_degree_ / 180.0 * M_PI, | ^~~~~~~~~~ | AngleAxis /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp: In function ‘int main(int, char**)’: /home/bst/Music/SensorsCalibration/SensorsCalibration-master/surround-camera/manual_calib/src/run_avm.cpp:367:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<double, std::allocator<double> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 367 | for (int j = 0; j < dist[i].size(); j++) | ~~^~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/lidar2camera.dir/build.make:76: CMakeFiles/lidar2camera.dir/src/run_avm.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/lidar2camera.dir/all] Error 2 make: *** [Makefile:91: all] Error 2
07-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值