yue_pan_pan 2022-08-23 17:07 采纳率: 47.6%
浏览 35
已结题

opengles 头文件定义得函数,包含进来还是提示没有定义

问题遇到的现象和发生背景

img

img

问题相关代码,请勿粘贴截图

#include <detail/type_mat.hpp>
#include <detail/type_mat4x4.hpp>
#include "GLSampleBase.h"
#include <Matrix.h>
#include <esShapes.h>
#include <esTransform.h>
#include <GLUtils.h>
void BeatingHeartSample::initMVP(int m_Width, int m_Height) {
ESMatrix perspective;
ESMatrix ortho;
ESMatrix modelView;
ESMatrix model;
ESMatrix view;

float aspect;
// Compute the window aspect ratio
aspect = (GLfloat)m_Width / (GLfloat)m_Height;

// Generate a perspective matrix with a 45 degree FOV for the scene rendering
esMatrixLoadIdentity(&perspective);
esPerspective(&perspective, 45.0f, aspect, 0.1f, 100.0f);

// 用光源位置建立一个MVP矩阵
// 通过连接 正交投影、模型和视图变换矩阵生成的MVP变换矩阵
// Generate an orthographic projection matrix for the shadow map rendering
esMatrixLoadIdentity(&ortho);
esOrtho(&ortho, -10, 10, -10, 10, -30, 30);

// GROUND
// Generate a model view matrix to rotate/translate the ground
esMatrixLoadIdentity(&model);

// Center the ground
esTranslate(&model, -2.0f, -2.0f, 0.0f);
esScale(&model, 10.0f, 10.0f, 10.0f);
esRotate(&model, 90.0f, 1.0f, 0.0f, 0.0f);

// ----------   用眼睛位置建立MVP矩阵  ----------  开始

// Create view matrix transformation from the eye position
esMatrixLookAt(&view,
    eyePosition[0], eyePosition[1], eyePosition[2],
    0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f);

esMatrixMultiply(&modelView, &model, &view);

// Compute the final ground MVP for the scene rendering by multiplying the 
// modelview and perspective matrices together
esMatrixMultiply(&groundMvpMatrix, &modelView, &perspective);

// Create view matrix transformation from the light position
esMatrixLookAt(&view,
    lightPosition[0], lightPosition[1], lightPosition[2],
    0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f);

esMatrixMultiply(&modelView, &model, &view);

// Compute the final ground MVP for the shadow map rendering by multiplying the 
// modelview and ortho matrices together
esMatrixMultiply(&groundMvpLightMatrix, &modelView, &ortho);

// ----------   用眼睛位置建立MVP矩阵  ----------  结束

// CUBE
// position the cube
esMatrixLoadIdentity(&model);
esTranslate(&model, 5.0f, -0.4f, -3.0f);
esScale(&model, 1.0f, 2.5f, 1.0f);
esRotate(&model, -15.0f, 0.0f, 1.0f, 0.0f);

// Create view matrix transformation from the eye position
esMatrixLookAt(&view,
    eyePosition[0], eyePosition[1], eyePosition[2],
    0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f);

esMatrixMultiply(&modelView, &model, &view);

// Compute the final cube MVP for scene rendering by multiplying the 
// modelview and perspective matrices together
esMatrixMultiply(&cubeMvpMatrix, &modelView, &perspective);

// Create view matrix transformation from the light position
esMatrixLookAt(&view,
    lightPosition[0], lightPosition[1], lightPosition[2],
    0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f);

esMatrixMultiply(&modelView, &model, &view);

// Compute the final cube MVP for shadow map rendering by multiplying the 
// modelview and ortho matrices together
esMatrixMultiply(&cubeMvpLightMatrix, &modelView, &ortho);

}
int BeatingHeartSample::initShadowMap() {
GLenum none = GL_NONE;
GLint defaultFramebuffer = 0;

// use 1K by 1K texture for shadow map
shadowMapTextureWidth = shadowMapTextureHeight = 1024;

glGenTextures(1, &shadowMapTextureId);
glBindTexture(GL_TEXTURE_2D, shadowMapTextureId);
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);

// Setup hardware comparison
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);

glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24,
    shadowMapTextureWidth, shadowMapTextureHeight,
    0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);

glBindTexture(GL_TEXTURE_2D, 0);

glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFramebuffer);

// setup fbo
glGenFramebuffers(1, &shadowMapBufferId);
glBindFramebuffer(GL_FRAMEBUFFER, shadowMapBufferId);

glDrawBuffers(1, &none);

glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
    GL_TEXTURE_2D, shadowMapTextureId, 0);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, shadowMapTextureId);

if (GL_FRAMEBUFFER_COMPLETE != glCheckFramebufferStatus(GL_FRAMEBUFFER)) {
    return GL_FALSE;
}

glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);

return GL_TRUE;

}

运行结果及报错内容

img

我的解答思路和尝试过的方法

#include <esTransform.h> 我该有得头文件都包含了。为什么老是报这种找不到没有定义得错误呢
undefined reference to `esMatrixLoadIdentity(ESMatrix*)'

  • 写回答

2条回答 默认 最新

  • 来灵 2022-08-23 21:17
    关注

    undefined reference to `esMatrixLoadIdentity(ESMatrix*)'
    能找到声明,找不到定义

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月1日
  • 已采纳回答 8月24日
  • 赞助了问题酬金20元 8月23日
  • 创建了问题 8月23日

悬赏问题

  • ¥18 深度学习tensorflow1,ssdv1,coco数据集训练一个模型
  • ¥100 关于注册表摄像头和麦克风的问题
  • ¥30 代码本地运行正常,但是TOMCAT部署时闪退
  • ¥15 关于#python#的问题
  • ¥15 主机可以ping通路由器但是连不上网怎么办
  • ¥15 数据库一张以时间排好序的表中,找出多次相邻的那些行
  • ¥50 关于DynamoRIO处理多线程程序时候的问题
  • ¥15 kubeadm部署k8s出错
  • ¥15 Abaqus打不开cae文件怎么办?
  • ¥15 小程序准备上线,软件开发公司需要提供哪些资料给甲方