Results 1 to 2 of 2

Thread: Multiple renders in one

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    3

    Multiple renders in one

    here's my problem:

    I want to particionate the canvas in 4 virtual quadrants and in every quadrant I want to render the same scene with different colors(with different fragment shaders), to compare some effects in real time. I am not sure how to do that. Should I render the same scene 4 times in 4 different textures and then refill 4 rectangles with those textures? Or should I make another fshader and manually fill all the fragments with those textures? Any posibility to user render buffer objects to increase performance?

    Thanks in advance,

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    12

    Re: Multiple renders in one

    For rendering to quadrants you can set the viewport and scissor

    Code :
    var views = [
    { left: 0, 
       bottom: 0, 
       width: canvas.width / 2, 
       height: canvas.height, 
       eye: [0, 0, -10],
       target: [0, 0, 0],
       up: [0,1, 0]
    },
    { left: canvas.width / 2, 
       bottom: 0, 
       width: canvas.width / 2, 
       height: canvas.height, 
       eye: [-10, 0, 0],
       target: [0, 0, 0],
       up: [0,1, 0]
    },
    ];
     
    gl.enable(gl.SCISSOR_TEST);
    for (var ii = 0; ii < views.length; ++ii) {
       var view = views[ii];
       gl.scissor(view.left. view.bottom, view.width, view.height);
       gl.viewport(view.left, view.bottom, view.width, view.height);
       drawScene(view.eye, view.target, view.up, view.fov);
    }

    Something like that.

    There's a sample here
    http://webglsamples.googlecode.com/hg/m ... views.html

    As far as rendering each one differently I think you'll need to draw everything 4 times, once with each set of different shaders.

Similar Threads

  1. How to do Multiple Meshes? Multiple Programs?
    By amadeustesla in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 1
    Last Post: 11-04-2010, 11:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •