OpenCAX/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.cpp

36 lines
1.1 KiB
C++

//
// Created on 2026/3/6.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".
#include "V3dOGD.h"
#ifndef NATIVE_TAG
#define NATIVE_TAG "GRAPHIC_DRIVER"
#endif
namespace NativeOpenCAX {
V3dOGD::V3dOGD() : graphicDriver(nullptr), displayConnection(nullptr) {}
V3dOGD::~V3dOGD() {}
bool V3dOGD::InitV3dOGD(EGLCore& eglCore) {
try {
displayConnection = new Aspect_DisplayConnection();
graphicDriver = new OpenGl_GraphicDriver(displayConnection, false);
graphicDriver->ChangeOptions().buffersNoSwap = true;
graphicDriver->InitEglContext(eglGetCurrentDisplay(), eglGetCurrentContext(), eglCore.getConfig());
HILOG_INFO(NATIVE_TAG, "InitGraphicDriver Done");
return true;
} catch (std::exception &e) {
HILOG_INFO(NATIVE_TAG, "InitGraphicDriver Fail:%{public}d", e.what());
return false;
}catch (...) {
HILOG_ERROR(NATIVE_TAG, "InitGraphicDriver unknown exception occurred when creating Aspect_DisplayConnection.");
return false;
}
}
} // namespace NativeOpenCAX