Skip to content

Commit

Permalink
Merge branch 'bug24', remote branch 'mike/24-defaults' into bug24
Browse files Browse the repository at this point in the history
  • Loading branch information
Andor committed Jul 24, 2010
2 parents 32d58b4 + 038ffde commit a68d583
Showing 1 changed file with 38 additions and 29 deletions.
67 changes: 38 additions & 29 deletions psapi.js
Expand Up @@ -764,34 +764,12 @@ function PointStream(){
},

/**
Resize the viewport.
This can be called after setup
width
height
Sets variables to default values.
*/
resize: function(width, height){
// delete old program object?
// delete old context?

canvas.setAttribute("width", width);
canvas.setAttribute("height", height);

// check if style exists? how? can't just query it...
canvas.style.width = xb.width = width;
canvas.style.height = xb.height = height;

ctx = canvas.getContext("experimental-webgl");
ctx.viewport(0, 0, width, height);
ctx.enable(ctx.DEPTH_TEST);

xb.background(bk);

progObj = createProgramObject(ctx, vertexShaderSource, fragmentShaderSource);
ctx.useProgram(progObj);

runDefault: function(){

var fovy = 60;
var aspect = width/height;
var aspect = this.width/this.height;
var znear = 0.001;
var zfar = 1000;

Expand All @@ -811,16 +789,47 @@ function PointStream(){
var B = (top + bottom) / (top - bottom);
var C = -(zfar + znear) / (zfar - znear);
var D = -2 * zfar * znear / (zfar - znear);

projection = M4x4.$(
X, 0, A, 0,
0, Y, B, 0,
0, 0, C, D,
0, 0, -1, 0);

view = M4x4.$(1,0,0,0,0,1,0,0,0,0,1, 0,0,0,0,1);
view = M4x4.$(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);
model = M4x4.$(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);
normalTransform = M4x4.$(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);
normalTransform = M4x4.$(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);

},

/**
Resize the viewport.
This can be called after setup
width
height
*/
resize: function(width, height){
// delete old program object?
// delete old context?

canvas.setAttribute("width", width);
canvas.setAttribute("height", height);

// check if style exists? how? can't just query it...
canvas.style.width = xb.width = width;
canvas.style.height = xb.height = height;

ctx = canvas.getContext("experimental-webgl");
ctx.viewport(0, 0, width, height);
ctx.enable(ctx.DEPTH_TEST);

xb.background(bk);

progObj = createProgramObject(ctx, vertexShaderSource, fragmentShaderSource);
ctx.useProgram(progObj);

xb.runDefault();

// if VBOs already exist, recreate them
if(VBOs) {
Expand Down

0 comments on commit a68d583

Please sign in to comment.