From 1d92e985a52b908bf5276228e9fe147c02669f95 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Sun, 3 Nov 2024 05:10:07 +0400 Subject: [PATCH] Adjust cpp --- README.md | 2 +- core.js | 4 ++-- src/cpp/clear.cpp | 3 --- src/cpp/draw.cpp | 3 --- src/cpp/programs.cpp | 1 - src/cpp/sync.cpp | 2 -- src/cpp/transformfeedback.cpp | 2 -- src/cpp/vertexarrays.cpp | 3 --- src/cpp/webgl.cpp | 7 ++----- 9 files changed, 5 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 71e6b3a..7613cd4 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ and additional browser-like interfaces. Those two are bundled into the [3d-core-raub](https://github.com/node-3d/3d-core-raub) in a following manner: -``` +```js const image = require('image-raub'); const webgl = require('webgl-raub'); const { Document } = require('glfw-raub'); diff --git a/core.js b/core.js index 95b3476..5f3dd54 100644 --- a/core.js +++ b/core.js @@ -1,10 +1,10 @@ 'use strict'; require('segfault-raub'); - require('deps-opengl-raub'); +const { getBin, createLogger } = require('addon-tools-raub'); -const { getBin } = require('addon-tools-raub'); +createLogger({ name: 'webgl' }); const core = require(`./${getBin()}/webgl`); diff --git a/src/cpp/clear.cpp b/src/cpp/clear.cpp index 9332fa1..018bb01 100644 --- a/src/cpp/clear.cpp +++ b/src/cpp/clear.cpp @@ -1,6 +1,3 @@ -#include -#include - #include "webgl.hpp" diff --git a/src/cpp/draw.cpp b/src/cpp/draw.cpp index 05c4375..ccee047 100644 --- a/src/cpp/draw.cpp +++ b/src/cpp/draw.cpp @@ -1,6 +1,3 @@ -#include -#include - #include "webgl.hpp" diff --git a/src/cpp/programs.cpp b/src/cpp/programs.cpp index e0fcc56..7203c2a 100644 --- a/src/cpp/programs.cpp +++ b/src/cpp/programs.cpp @@ -1,5 +1,4 @@ #include "webgl.hpp" -#include namespace webgl { diff --git a/src/cpp/sync.cpp b/src/cpp/sync.cpp index 791e6e5..29e5a3f 100644 --- a/src/cpp/sync.cpp +++ b/src/cpp/sync.cpp @@ -1,5 +1,3 @@ -#include - #include "webgl.hpp" /** diff --git a/src/cpp/transformfeedback.cpp b/src/cpp/transformfeedback.cpp index fa91ed9..b726adb 100644 --- a/src/cpp/transformfeedback.cpp +++ b/src/cpp/transformfeedback.cpp @@ -1,5 +1,3 @@ -#include - #include "webgl.hpp" diff --git a/src/cpp/vertexarrays.cpp b/src/cpp/vertexarrays.cpp index 276faa1..7f5291e 100644 --- a/src/cpp/vertexarrays.cpp +++ b/src/cpp/vertexarrays.cpp @@ -1,6 +1,3 @@ -#include -#include - #include "webgl.hpp" diff --git a/src/cpp/webgl.cpp b/src/cpp/webgl.cpp index 60f8958..68719d2 100644 --- a/src/cpp/webgl.cpp +++ b/src/cpp/webgl.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include "webgl.hpp" @@ -14,7 +10,8 @@ DBG_EXPORT JS_METHOD(init) { NAPI_ENV; GLenum err = glewInit(); if (GLEW_OK != err) { - std::cerr << "Error: " << glewGetErrorString(err) << std::endl; + const GLubyte *text = glewGetErrorString(err); + globalLog(env, "webgl", "error", reinterpret_cast(text)); JS_THROW("Can't initialize GLEW."); }