Search Results

Search found 1 results on 1 pages for 'snackbar'.

Page 1/1 | 1 

  • Draw camera position in specific view port.

    - by snackbar
    Most of this code should be fairly self explanatory. I got an display function and my view port function. There are two modes which is 4 small view ports in the window or one large. I got one camera which can be moved and if in 4 view port mode just 3 fixed angles. The thing is I want the free moving cameras position to be displayed in the 3 other view ports. I tried doing it by drawing spheres using opengl but the problem is that then the position gets draw in the free roaming camera too as it shows the same scene. It doesn't have to be a sphere, just something simple that represents the cameras spacial position in these three other views. Drawing the scene once with camera object showing for the three viewports, render to texture. Clear and draw scene without camera object render to texture and then stitch these together before actually drawing the scene seems like a lot o work for something that should be easy. void display(int what) { if(what==5){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camControll();} if(what==1){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(75,15,-5,0,5,-5,0,1,0);} if(what==2){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0,110,0,0,0,0,1,0,0);} if(what==3){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, float(320) / float(240), 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camControll();} if(what==4){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(185,75,25,0,28,0,0,1,0);} glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); drawScene(); drawCamera(); glutSwapBuffers(); } void viewport(){ glEnable(GL_SCISSOR_TEST); if(!divided_view_port) { glViewport(0, 0, w, h); glScissor(0,0,640,480); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, w / h, 0.1f, 100.0f); display(5); } else { ////////////////////// bottom left - working glViewport(0, 0, w/2, h/2); glScissor(0,0,w/2,h/2); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, w / h, 0.1f, 300.0f); display(1); ////////////////////// ////////////////////// top right - working glViewport(w/2, h/2, w/2, h/2); glScissor(w/2,h/2,w/2,h/2); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, w / h, 0.1f, 300.0f); display(2); ////////////////////// ////////////////////// bottom right -working glViewport(w/2, 0, w/2, h/2); glScissor(w/2,0,w/2,h/2); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, w / h, 0.1f, 300.0f); display(3); //////////////////////// ////////////////////////// top left glViewport(0, h/2, w/2, h/2); glScissor(0,h/2,w/2,h/2); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, w / h, 0.1f, 300.0f); display(4); /////////////////////////// } glDisable(GL_SCISSOR_TEST); glMatrixMode(GL_MODELVIEW); }

    Read the article

1