小编use*_*842的帖子

OpenGL中八面体的递归细分

在没有使用gluSphere()的情况下在OpenGL中引用了这个帖子Drawing Sphere?这对我帮助很大,但我现在很难过.

我的场景中有一个八面体,我现在想要递归细分三角形以创建一个球体.我发现这段代码应该为我进行细分,但我完全不理解

void subdivide(GLfloat v1[3], GLfloat v2[3], GLfloat v3[3], int depth)
{
    GLfloat v12[3], v23[3], v31[3]; int i;
    if (depth == 0) {
    drawTriangle(v1, v2, v3);
    return;
}
for (i = 0; i < 3; i++) 
{
    v12[i] = (v1[i]+v2[i])/2.0;
    v23[i] = (v2[i]+v3[i])/2.0;
    v31[i] = (v3[i]+v1[i])/2.0;
}
Run Code Online (Sandbox Code Playgroud)

我设置了一个结构来保持位置,法线和颜色

// simple vertex container
struct SimpleVertex
{
    vec3        pos;    // Position
    vec3        normal  // Normal
    vec4        colour; // Colour
};
Run Code Online (Sandbox Code Playgroud)

这就是我设置顶点的地方

 /*
    *
    * This is just …
Run Code Online (Sandbox Code Playgroud)

opengl recursion division

4
推荐指数
1
解决办法
2632
查看次数

node.js bodyParser错误

我正在按照一个教程来设置node.js服务器和mongoDB数据库.我正处于需要启动npm的位置,但这是它返回的错误

C:\Users\Jay\IdeaProjects\nodetest1>npm start

> application-name@0.0.1 start C:\Users\Jay\IdeaProjects\nodetest1
> node ./bin/www


    module.js:340
        throw err;
              ^
    Error: Cannot find module 'bodyParser'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (C:\Users\Jay\IdeaProjects\nodetest1\app.js:6:18)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)

npm ERR! application-name@0.0.1 start: `node ./bin/www`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the application-name@0.0.1 start script.
npm ERR! This is most likely a problem with the …
Run Code Online (Sandbox Code Playgroud)

parsing mongodb node.js

3
推荐指数
1
解决办法
6152
查看次数

发生错误:产生ENOENT,node.js和FFmpeg

我在一次噩梦中试图解决这个问题。昨天我问了一个问题,但到目前为止,长话短说,我一生无法解决。

我要做的就是在node.js应用程序中使用FFmpeg将.avi文件转码为.flv文件,这仅适用于FFmpeg的命令行,而在应用程序中无效,这是代码:

var ffmpeg = require('fluent-ffmpeg');

//make sure you set the correct path to your video file
var proc = new ffmpeg({ source: 'C:/Users/Jay/Documents/movie/drop.avi', nolog: true });

//Set the path to where FFmpeg is installed
proc.setFfmpegPath("C:\\Users\\Jay\\Documents\\FFMPEG\\bin");

proc
//set the size
//.withSize('50%') <-- error appears after this line

// set fps
//.withFps(24)

// set output format to force
//.toFormat('flv')

// setup event handlers
.on('end', function() {
    console.log('file has been converted successfully');
})
.on('error', function(err) {
    console.log('an error happened: ' + err.message); …
Run Code Online (Sandbox Code Playgroud)

transcode ffmpeg node.js

3
推荐指数
1
解决办法
9068
查看次数

标签 统计

node.js ×2

division ×1

ffmpeg ×1

mongodb ×1

opengl ×1

parsing ×1

recursion ×1

transcode ×1