<div dir="ltr"><div class="markdown-here-wrapper" style="font-family:"Lucida Sans",Cantarell,Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">Hi Elaine,</p>
<p style="margin:0px 0px 1.2em!important">I see. In that case, you can remove all the code where you’re explicitly setting the projection and view matrices on the external camera. The external renderer handles that internally (automatically). The external renderer is responsible for updating the VTK camera matrices based on the OpenGL state.</p>
<p style="margin:0px 0px 1.2em!important">Thanks,<br>Sankhesh</p>
<div title="MDH:SGkgRWxhaW5lLDxkaXY+PGJyPjwvZGl2PjxkaXY+SSBzZWUuIEluIHRoYXQgY2FzZSwgeW91IGNh
biByZW1vdmUgYWxsIHRoZSBjb2RlIHdoZXJlIHlvdSdyZSBleHBsaWNpdGx5IHNldHRpbmcgdGhl
IHByb2plY3Rpb24gYW5kIHZpZXcgbWF0cmljZXMgb24gdGhlIGV4dGVybmFsIGNhbWVyYS4gVGhl
IGV4dGVybmFsIHJlbmRlcmVyIGhhbmRsZXMgdGhhdCBpbnRlcm5hbGx5IChhdXRvbWF0aWNhbGx5
KS4gVGhlIGV4dGVybmFsIHJlbmRlcmVyIGlzIHJlc3BvbnNpYmxlIGZvciB1cGRhdGluZyB0aGUg
VlRLIGNhbWVyYSBtYXRyaWNlcyBiYXNlZCBvbiB0aGUgT3BlbkdMIHN0YXRlLjwvZGl2PjxkaXY+
PGJyPjwvZGl2PjxkaXY+VGhhbmtzLDwvZGl2PjxkaXY+U2Fua2hlc2g8L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 20, 2017 at 2:13 PM Elaine Jiang <<a href="mailto:elainejiang8@gmail.com">elainejiang8@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Sankhesh,<div><br></div><div>That makes sense! However, my end goal is indeed to integrate with a virtual reality system that is controlling the OpenGL camera -  I was just trying to get the external camera to work before integrating with a VR program. I can attach the render function that I'm working on that is part of a VR program. Here, I'm using SetViewTransformMatrix() and SetProjectionTransformMatrix(). Sorry for the confusion before, and thanks for your quick replies!</div><div><br></div><div><div><br></div><div>    /// This is called each time through the main graphics loop, and</div><div>    /// re-draws the scene according to whatever has changed since the</div><div>    /// last time it was drawn.</div><div>    <b>void onVRRenderGraphics(const MinVR::VRGraphicsState &renderState) {</b></div><div>        // Only draw if the application is still running.</div><div>        <b>if (isRunning()) {</b></div></div></div><div dir="ltr"><div><div>            // Enable depth testing. Demonstrates OpenGL context being managed by external</div><div>            // application i.e. GLUT in this case.</div><div>            <b>glEnable(GL_DEPTH_TEST);</b></div><div><br></div><div>            // Buffers being managed by external application i.e. GLUT in this case.</div></div></div><div dir="ltr"><div><div>            <b>glClearColor(1.0f, 1.0f, 1.0f, 0.0f);</b></div></div></div><div dir="ltr"><div><div>            <b>glClearDepth(1.0f);</b></div><div>            <b>glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);</b> // Clear the color buffer</div><div><br></div><div>            <b>glFlush(); </b> // Render now</div><div><br></div><div>            <b>glEnable(GL_LIGHTING);</b></div><div><b>            glEnable(GL_LIGHT0);</b></div><div><b><br></b></div></div></div><div dir="ltr"><div><div>           // color</div><div>            <b>GLfloat diffuse[] = {1.0f, 0.8f, 1.0f, 1.0f};</b></div></div></div><div dir="ltr"><div><div><b>            glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);</b></div><div><b>            GLfloat specular[] = {0.5f, 0.0f, 0.0f, 1.0f};</b></div><div><b>            glLightfv(GL_LIGHT0, GL_SPECULAR, specular);</b></div><div><b>            GLfloat ambient[] = {1.0f, 1.0f, 0.2f,  1.0f};</b></div><div><b>            glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);</b></div><div>            </div><div>            </div></div></div><div dir="ltr"><div><div>            // Second the load() step.  We let MinVR give us the projection</div><div>            // matrix from the render state argument to this method.</div><div><div>            <b>const float* pm = renderState.getProjectionMatrix();</b></div><div><b>            glm::mat4 projMatrix = glm::mat4( pm[0],  pm[1], pm[2], pm[3],</b></div><div><b>                                            pm[4],  pm[5], pm[6], pm[7],</b></div><div><b>                                            pm[8],  pm[9],pm[10],pm[11],</b></div><div><b>                                            pm[12],pm[13],pm[14],pm[15]);</b></div><div><br></div><div>            // The draw step.  We let MinVR give us the view matrix.</div><div>            <b>const float* vm = renderState.getViewMatrix();</b></div><div><b>            glm::mat4 viewMatrix = glm::mat4( vm[0],  vm[1], vm[2], vm[3],</b></div><div><b>                                            vm[4],  vm[5], vm[6], vm[7],</b></div><div><b>                                            vm[8],  vm[9],vm[10],vm[11],</b></div><div><b>                                            vm[12],vm[13],vm[14],vm[15]);</b></div><div><b><br></b></div><div><b><br></b></div><div><b>            camera = (vtkExternalOpenGLCamera *)ren->GetActiveCamera();</b></div><div><br></div><div>            <b>double view[16];</b></div><div><b>            for(int i = 0; i < 16; i++) {</b></div><div><b>                view[i] = glm::value_ptr(viewMatrix)[i];</b></div><div><b>            }</b></div><div><br></div><div>            <b>camera->SetViewTransformMatrix(view);</b></div><div><b><br></b></div><div><b>            double proj[16];</b></div><div><b>            for(int i = 0; i < 16; i++) {</b></div><div><b>                proj[i] = glm::value_ptr(projMatrix)[i];</b></div><div><b>            }</b></div><div><b><br></b></div><div><b>            camera->SetProjectionTransformMatrix(proj);</b></div><div> </div></div></div></div><div dir="ltr"><div><div><b><br></b></div><div><b>            for(int i = 0; i < 7; i++) {</b></div><div><b>                // transpose - vtk</b></div></div></div><div dir="ltr"><div><div><b>                //actors[i]->SetOrientation(0,0,0);</b></div></div></div><div dir="ltr"><div><div><b>                actors[i]->RotateX(y_angle);</b></div><div><b>                actors[i]->RotateY(x_angle);</b></div><div><b>                actors[i]->SetScale(scale_size);</b></div><div><b>            }</b></div><div><b><br></b></div></div></div><div dir="ltr"><div><div><b>            externalVTKWidget->GetRenderWindow()->Render();</b></div><div>      </div><div>            // We let MinVR swap the graphics buffers.</div><div>            // glutSwapBuffers();</div><div>       <b> }</b></div><div><b>    }</b></div><div><b>    };</b></div></div><div><b><br></b></div><div><b><br></b></div><div>Thanks,</div><div>Elaine</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 20, 2017 at 2:00 PM, Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="m_3434931704934392675m_4229711617053496142markdown-here-wrapper" style="font-family:'Lucida Sans',Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">Hi Elaine,</p>
<p style="margin:0px 0px 1.2em!important">I didn’t see anything obvious in your sample code so decided to look more closely at the external renderer implementation. Its been a while since I looked at that code and my memory was rusty.</p>
<p style="margin:0px 0px 1.2em!important">You don’t need the external renderer if you are driving the OpenGL scene via VTK. Think of the external renderer as glue code that synchronizes the external OpenGL scene with VTK. It makes sure that the camera used is an external camera and overrides the camera parameters with what it finds in the external OpenGL scene. You need it in cases where something else is controlling the OpenGL camera and you’d like the VTK scene to be up-to-date as well; e.g. virtual reality systems where the main application updates OpenGL camera parameters.</p>
<p style="margin:0px 0px 1.2em!important">In your case, you can simply instantiate a <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkRenderer</code> and set it on the <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkExternalOpenGLRenderWindow</code> via <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkRenderWindow::AddRenderer(vtkRenderer* ren)</code>. The rest of the code should work as expected - except that the active camera would be of type <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkOpenGLCamera</code> instead of <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkExternalOpenGLCamera</code>. </p>
<p style="margin:0px 0px 1.2em!important">Hope that helps.</p>
<p style="margin:0px 0px 1.2em!important">Sankhesh</p>
<div title="MDH:SGkgRWxhaW5lLDxkaXY+PGJyPjwvZGl2PjxkaXY+SSBkaWRuJ3Qgc2VlIGFueXRoaW5nIG9idmlv
dXMgaW4geW91ciBzYW1wbGUgY29kZSBzbyBkZWNpZGVkIHRvIGxvb2sgbW9yZSBjbG9zZWx5IGF0
IHRoZSBleHRlcm5hbCByZW5kZXJlciBpbXBsZW1lbnRhdGlvbi4gSXRzIGJlZW4gYSB3aGlsZSBz
aW5jZSBJIGxvb2tlZCBhdCB0aGF0IGNvZGUgYW5kIG15IG1lbW9yeSB3YXMgcnVzdHkuPC9kaXY+
PGRpdj48YnI+PC9kaXY+PGRpdj5Zb3UgZG9uJ3QgbmVlZCB0a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jdGl2ZSBjYW1lcmEgd291bGQgYmUgb2YgdHlwZSBgdnRrT3BlbkdMQ2Ft
ZXJhYCBpbnN0ZWFkIG9mIGB2dGtFeHRlcm5hbE9wZW5HTENhbWVyYWAuJm5ic3A7PC9kaXY+PGRp
dj48YnI+PC9kaXY+PGRpdj5Ib3BlIHRoYXQgaGVscHMuPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRp
dj5TYW5raGVzaDwvZGl2PjxkaXY+PGJyPjwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><div class="m_3434931704934392675HOEnZb"><div class="m_3434931704934392675h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 20, 2017 at 1:31 PM Elaine Jiang <<a href="mailto:elainejiang8@gmail.com" target="_blank">elainejiang8@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Sankhesh,<div><br></div><div>Here's my initialization function and my render function. The external camera set up is highlighted. <br><div><b><br></b></div><div><div><b>vtkNew<ExternalVTKWidget> externalVTKWidget;</b></div><div><b>vtkSmartPointer<vtkRenderer> ren = externalVTKWidget->AddRenderer();</b></div><div><b>static int windowId = -1;</b></div><div><b>static int windowH = 800;</b></div><div><b>static int windowW = 800;</b></div><div><b>vtkSmartPointer<vtkActor> actors[7];</b></div><div><b><br></b></div><div><b>vtkNew<vtkTransform> transform;</b></div><div><b>int press_x, press_y;</b></div><div><b>int release_x, release_y;</b></div><div><b>float x_angle = 0.0;</b></div><div><b>float y_angle = 0.0;</b></div><div><b>float scale_size = 1;</b></div><div><b>int xform_mode = 0;</b></div><div><b>#define XFORM_NONE    0</b></div><div><b>#define XFORM_ROTATE  1</b></div><div><b>#define XFORM_SCALE 2</b></div><div><br></div><div><br></div><div><b>void initialize() {</b></div><div>    <b>vtkNew<vtkExternalOpenGLRenderWindow> renWin;</b></div><div><b>    externalVTKWidget->SetRenderWindow(renWin.GetPointer());</b></div><div>    </div><div>    <b>std::string files[7] = {"../data/newsi-ascii.vtk", "../data/newjets-ascii.vtk", "../data/fekcorr-ascii.vtk", "../data/newar-ascii.vtk", "../data/newhetg-ascii.vtk", "../data/newopt-ascii.vtk", "../data/newsi-ascii.vtk"};</b></div><div><b>    </b></div><div><b>    for(int i = 0; i < 7; i++) {</b></div><div>       <b> vtkSmartPointer<vtkPolyDataReader> reader =</b></div><div><b>        vtkSmartPointer<vtkPolyDataReader>::New();</b></div><div><b>        reader->SetFileName(files[i].c_str());</b></div><div><b>        reader->Update();</b></div><div><b>        vtkSmartPointer<vtkPolyData> inputPolyData = reader->GetOutput();</b></div><div><b><br></b></div><div><b>        vtkSmartPointer<vtkCleanPolyData> clean =</b></div><div><b>        vtkSmartPointer<vtkCleanPolyData>::New();</b></div><div><b>        clean->SetInputData(inputPolyData);</b></div><div><br></div><div>        // Generate normals</div><div>        <b>vtkSmartPointer<vtkPolyDataNormals> normals =</b></div><div><b>        vtkSmartPointer<vtkPolyDataNormals>::New();</b></div><div><b>        normals->SetInputConnection(clean->GetOutputPort());</b></div><div><b>        normals->SplittingOff();</b></div><div>        </div><div><br></div><div>        <b>vtkSmartPointer<vtkPolyDataMapper> mapper =</b></div><div><b>        vtkSmartPointer<vtkPolyDataMapper>::New();</b></div><div><b>        mapper->SetInputConnection(normals->GetOutputPort());</b></div><div><br></div><div>        <b>vtkSmartPointer<vtkActor> actor =</b></div><div><b>        vtkSmartPointer<vtkActor>::New();</b></div><div><b>        actor->SetMapper(mapper);</b></div><div><b>        actor->GetProperty()->SetInterpolationToFlat();</b></div><div><b><br></b></div><div><b>        ren->AddActor(actor);</b></div><div><b>        actors[i] = actor;</b></div><div><b>    }</b></div><div>    </div><div>    <b>ren->SetBackground(0, 0, 0);</b></div><div><b style="background-color:rgb(255,217,102)">    ren->MakeCamera();</b></div><div><b style="background-color:rgb(255,217,102)">    ren->ResetCamera();</b></div><div><b>    renWin->AddRenderer(ren);</b></div><div><b>}</b></div><div><br></div><div>// Render function</div><div><b>void display() {</b></div><div>    // Enable depth testing. Demonstrates OpenGL context being managed by external</div><div>    // application i.e. GLUT in this case.</div><div>    <b>glEnable(GL_DEPTH_TEST);</b></div><div><br></div><div>    // Buffers being managed by external application i.e. GLUT in this case.</div><div>    <b>glClearColor(0.0f, 0.0f, 0.0f, 1.0f);</b> // Set background color to black and opaque</div><div>    <b>glClearDepth(1.0f);</b></div><div>    <b>glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);</b> // Clear the color buffer</div><div><br></div><div>    <b>glFlush();</b>  // Render now</div><div><br></div><div>    <b>glEnable(GL_LIGHTING);</b></div><div><b>    glEnable(GL_LIGHT0);</b></div><div>    </div><div>    <b>GLfloat diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};</b></div><div><b>    glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);</b></div><div><b>    GLfloat specular[] = {0.5f, 0.0f, 0.0f, 1.0f};</b></div><div><b>    glLightfv(GL_LIGHT0, GL_SPECULAR, specular);</b></div><div><b>    GLfloat ambient[] = {1.0f, 1.0f, 0.2f,  1.0f};</b></div><div><b>    glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);</b></div><div><br></div><div><br></div><div><span style="background-color:rgb(255,217,102)">    <b>vtkExternalOpenGLCamera *camera = (vtkExternalOpenGLCamera *)ren->GetActiveCamera();</b></span></div><div><b style="background-color:rgb(255,217,102)">    camera->SetPosition(0,0,-100);</b></div><div><b style="background-color:rgb(255,217,102)">    camera->SetFocalPoint(0,0,0); </b></div><div><b style="background-color:rgb(255,217,102)">    camera->SetViewUp(0,1,0); </b></div><div><br></div><div>    </div><div>    <b>for(int i = 0; i < 7; i++) {</b></div><div><b>        // transpose - vtk</b></div><div><b>        actors[i]->SetOrientation(0,0,0);</b></div><div><b>        actors[i]->RotateX(y_angle);</b></div><div><b>        actors[i]->RotateY(x_angle);</b></div><div><b>        actors[i]->SetScale(scale_size);</b></div><div><b>        </b></div><div><b>        // transpose - opengl</b></div><div><b>        double f[16];</b></div><div><b>        actors[i]->GetMatrix(f);</b></div><div><b><br></b></div><div><b>        // transpose</b></div><div><b>        double g[16];</b></div><div><b>        g[0] = f[0]; g[1] = f[4]; g[2] = f[8]; g[3] = f[12];</b></div><div><b>        g[4] = f[1]; g[5] = f[5]; g[6] = f[9]; g[7] = f[13];</b></div><div><b>        g[8] = f[2]; g[9] = f[6]; g[10]= f[10];g[11]= f[14];</b></div><div><b>        g[12]= f[3]; g[13]= f[7]; g[14]= f[11];g[15]= f[15];</b></div><div><b>        glMultMatrixd(g); // multiply current matrix with specified matrix</b></div><div><b>    }</b></div><div><br></div><div>    <b>externalVTKWidget->GetRenderWindow()->Render();</b></div><div><b>    glutSwapBuffers();</b></div><div><b>}</b></div></div></div><div><b><br></b></div><div>Thanks,</div><div>Elaine</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 20, 2017 at 1:11 PM, Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565markdown-here-wrapper" style="font-family:'Lucida Sans',Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">Hi Elaine,</p>
<p style="margin:0px 0px 1.2em!important">You shouldn’t have to set that flag for using the matrices set on the external camera. Could you share some sample code that doesn’t work?</p>
<p style="margin:0px 0px 1.2em!important">Thanks,<br>Sankhesh</p>
<div title="MDH:SGkgRWxhaW5lLDxkaXY+PGJyPjwvZGl2PjxkaXY+WW91IHNob3VsZG4ndCBoYXZlIHRvIHNldCB0
aGF0IGZsYWcgZm9yIHVzaW5nIHRoZSBtYXRyaWNlcyBzZXQgb24gdGhlIGV4dGVybmFsIGNhbWVy
YS4gQ291bGQgeW91IHNoYXJlIHNvbWUgc2FtcGxlIGNvZGUgdGhhdCBkb2Vzbid0IHdvcms/PC9k
aXY+PGRpdj48YnI+PC9kaXY+PGRpdj5UaGFua3MsPC9kaXY+PGRpdj5TYW5raGVzaDwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319HOEnZb"><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 20, 2017 at 11:38 AM Elaine Jiang <<a href="mailto:elainejiang8@gmail.com" target="_blank">elainejiang8@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Sankhesh,<div><br></div><div>I've tried setting the camera and focal point parameters without using SetProjectionMatrix() and SetModelViewTransformMatrix(), and I've also tried just calling SetProjectionMatrix() and SetModelViewTransformMatrix() by themselves. Neither approach seemed to have an effect on the scene. I was looking through the documentation and was wondering if I need to use the function vtkCamera::vtkSetUseExplicitProjectionTransformMatrix(bool) to solve the problem?</div><div><br></div><div>Thanks,</div><div>Elaine</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 20, 2017 at 11:12 AM, Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427m_-7741260002236855523m_231165425845248325markdown-here-wrapper" style="font-family:'Lucida Sans',Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">Hi,</p>
<p style="margin:0px 0px 1.2em!important">Could you please provide more details on how you’re trying to set the camera parameters?<br>The way the external camera works is that it ignores the camera position and focal point parameters if the projection and model view matrices are set explicitly using  <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkExternalOpenGLCamera::SetProjectionMatrix()</code> and <code style="font-size:0.95em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(218,218,218);background-color:rgb(232,232,232);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">vtkExternalOpenGLCamera::SetModelViewTransformMatrix()</code></p>
<p style="margin:0px 0px 1.2em!important">Thanks,<br>Sankhesh</p>
<div title="MDH:SGksPGRpdj48YnI+PC9kaXY+PGRpdj5Db3VsZCB5b3UgcGxlYXNlIHByb3ZpZGUgbW9yZSBkZXRh
aWxzIG9uIGhvdyB5b3UncmUgdHJ5aW5nIHRvIHNldCB0aGUgY2FtZXJhIHBhcmFtZXRlcnM/PC9k
aXY+PGRpdj5UaGUgd2F5IHRoZSBleHRlcm5hbCBjYW1lcmEgd29ya3MgaXMgdGhhdCBpdCBpZ25v
cmVzIHRoZSBjYW1lcmEgcG9zaXRpb24gYW5kIGZvY2FsIHBvaW50IHBhcmFtZXRlcnMgaWYgdGhl
IHByb2plY3Rpb24gYW5kIG1vZGVsIHZpZXcgbWF0cmljZXMgYXJlIHNldCBleHBsaWNpdGx5IHVz
aW5nICZuYnNwO2B2dGtFeHRlcm5hbE9wZW5HTENhbWVyYTo6U2V0UHJvamVjdGlvbk1hdHJpeCgp
YCBhbmQgYHZ0a0V4dGVybmFsT3BlbkdMQ2FtZXJhOjpTZXRNb2RlbFZpZXdUcmFuc2Zvcm1NYXRy
aXgoKWA/PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5UaGFua3MsPC9kaXY+PGRpdj5TYW5raGVz
aDwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div><div><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427h5"><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 19, 2017 at 9:59 AM elainejiang8 <<a href="mailto:elainejiang8@gmail.com" target="_blank">elainejiang8@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone!<br>
<br>
I'm building a program that uses the externalVTKWidget to volume render an<br>
object in an OpenGL context. Right now, I'm calling<br>
<br>
*ren->GetActiveCamera();<br>
*<br>
<br>
(where ren is a vtkExternalOpenGLRenderWindow instance) in my render<br>
function so I can control the position and focal point of the camera.<br>
However, I'm unable to get the camera to actually have any effect on the<br>
scene. The documentation for vtkExternalOpenGLCamera is rather slim, and I<br>
can't find any similar examples, so I am a bit stuck on this issue.<br>
<br>
Does anyone have any insight into how I could approach this problem? Thanks<br>
in advance!<br>
<br>
Elaine<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Using-vtkExternalOpenGLCamera-tp5744015.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/Using-vtkExternalOpenGLCamera-tp5744015.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div></div></div></div><span class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427m_-7741260002236855523gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427m_-7741260002236855523inbox-markdown-here-wrapper" style="font-family:'proza libre',sans-serif;color:rgb(0,56,107)"><h5 id="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427m_-7741260002236855523inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565m_-7939614205799474427m_-7741260002236855523inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:'open sans',sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/" target="_blank">Kitware</a> | <a href="tel:(518)%20881-4417" value="+15188814417" target="_blank">(518) 881-4417</a></h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4Myw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;padding:0px;margin:0px">​</div></div></div></div>
</font></span></blockquote></div><br></div>
</blockquote></div><div dir="ltr">-- <br></div><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565inbox-markdown-here-wrapper" style="font-family:'proza libre',sans-serif;color:rgb(0,56,107)"><h5 id="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="m_3434931704934392675m_4229711617053496142m_-6852244649874200319m_-8095862806611381565inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:'open sans',sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/" target="_blank">Kitware</a> | <a href="tel:(518)%20881-4417" value="+15188814417" target="_blank">(518) 881-4417</a></h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></div>
</div></div></blockquote></div><br></div>
</blockquote></div><div dir="ltr">-- <br></div><div class="m_3434931704934392675m_4229711617053496142gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="m_3434931704934392675m_4229711617053496142inbox-markdown-here-wrapper" style="font-family:'proza libre',sans-serif;color:rgb(0,56,107)"><h5 id="m_3434931704934392675m_4229711617053496142inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="m_3434931704934392675m_4229711617053496142inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:'open sans',sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/" target="_blank">Kitware</a> | <a href="tel:(518)%20881-4417" value="+15188814417" target="_blank">(518) 881-4417</a></h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></div>
</div></div></blockquote></div><br></div>
</blockquote></div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="inbox-markdown-here-wrapper" style="font-family:'proza libre',sans-serif;color:rgb(0,56,107)"><h5 id="inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:'open sans',sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/">Kitware</a> | (518) 881-4417</h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></div>