mirror of
https://github.com/danbulant/node-x11
synced 2026-07-09 13:10:45 +00:00
draw first frame immediately
This commit is contained in:
parent
d2f6b9c7fc
commit
e712fdb0a5
1 changed files with 25 additions and 21 deletions
|
|
@ -27,22 +27,8 @@ x11.createClient(function(display) {
|
|||
var ctx = X.AllocID();
|
||||
GLX.CreateContext(ctx, visual, 0, 0, 0);
|
||||
GLX.MakeCurrent(win, ctx, 0, function(err, ctx) {}); // do we need to wait for reply here?
|
||||
GLX.GenLists(ctx, 1, function(err, startListIndex) {
|
||||
listId = startListIndex;
|
||||
GLX.NewList(ctx, listId, 0x00001300);
|
||||
var gl = GLX.renderPipeline();
|
||||
gl.Begin(0x0004);
|
||||
for (var i=0; i < 1000; ++i)
|
||||
{
|
||||
gl.Vertex3f(randomarr[i][0], randomarr[i][1], randomarr[i][2]);
|
||||
gl.Color3f((randomarr[i+1000][0]+15/30), (randomarr[i+1000][1]+15)/30, (randomarr[i+1000][2]+15)/30);
|
||||
}
|
||||
gl.End();
|
||||
gl.render(ctx);
|
||||
GLX.EndList(ctx);
|
||||
});
|
||||
|
||||
X.on('event', function(ev) {
|
||||
function draw(ev) {
|
||||
var gl = GLX.renderPipeline();
|
||||
gl.Enable(0x0B71);
|
||||
gl.Viewport(0, 0, 800, 800);
|
||||
|
|
@ -61,7 +47,25 @@ x11.createClient(function(display) {
|
|||
gl.CallList(listId);
|
||||
gl.render(ctx);
|
||||
GLX.SwapBuffers(ctx, win);
|
||||
}
|
||||
|
||||
GLX.GenLists(ctx, 1, function(err, startListIndex) {
|
||||
listId = startListIndex;
|
||||
GLX.NewList(ctx, listId, 0x00001300);
|
||||
var gl = GLX.renderPipeline();
|
||||
gl.Begin(0x0004);
|
||||
for (var i=0; i < 1000; ++i)
|
||||
{
|
||||
gl.Vertex3f(randomarr[i][0], randomarr[i][1], randomarr[i][2]);
|
||||
gl.Color3f((randomarr[i+1000][0]+15/30), (randomarr[i+1000][1]+15)/30, (randomarr[i+1000][2]+15)/30);
|
||||
}
|
||||
gl.End();
|
||||
gl.render(ctx);
|
||||
GLX.EndList(ctx);
|
||||
draw({x: 10, y: 10});
|
||||
});
|
||||
|
||||
X.on('event', draw);
|
||||
});
|
||||
X.on('error', function(err) { console.log(err); });
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue