From dumais01@aei.ca Tue Nov 9 13:33:22 2004 Received: with ECARTIS (v1.0.0; list info-inventor); Tue, 09 Nov 2004 13:33:28 -0800 (PST) Received: from aeimail.aei.ca (root@mail.aei.ca [206.123.6.14]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iA9LXLbr022024 for ; Tue, 9 Nov 2004 13:33:22 -0800 Received: from new-host.workgroup (dsl-132-3.aei.ca [66.36.132.3]) by aeimail.aei.ca (8.12.10/8.12.10) with ESMTP id iA9LX2gj024829 for ; Tue, 9 Nov 2004 16:33:02 -0500 (EST) Subject: OpenGL and OpenInventor merging problem From: louis To: info-inventor@oss.sgi.com Content-Type: text/plain; charset=iso-8859-13 Date: Tue, 09 Nov 2004 17:48:35 +0000 Message-Id: <1100022515.24703.2.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.0.1 Content-Transfer-Encoding: 8bit X-archive-position: 103 X-ecartis-version: Ecartis v1.0.0 Sender: info-inventor-bounce@oss.sgi.com Errors-to: info-inventor-bounce@oss.sgi.com X-original-sender: dumais01@aei.ca Precedence: bulk X-list: info-inventor Hi, I`m having technical problems merging OpenGL and Open Inventor and I'm asking for help to solve the problem. I could give a small paypal gift to the person solving the ´equationĦ. What I'm trying to do is to use OpenGL and OpenInventor in the same GL context and using the same camera for OpenGL and OpenInventor. This camera is the SoCamera from the OpenInventor package. This mean something like this: void draw(){ drawTheInventorStuff(); drawTheOpenGLStuff(); } The problem is that I cant get the same exact visualization coordinates for OpenGL and OpenInventor with the SoCamera and I dont know why. I have been reading a lot on the SoCamera and looking at the source code to finally isolate what I think are the two functions needed for my task : SbViewVolume::getMatrix() and SbViewVolume:: getMatrices( sbMatrixAffine , sbMatrixProjection) . Basically, at the moment, what I do is to take the SbViewVolume from the camera and getMatrix: SbViewVolume cameraSbViewVolume; cameraSbViewVolume = camera->getViewVolume(); sbMatrixCamera= cameraSbViewVolume.getMatrix();//working then I use glMatrixMode(GL_PROJECTION); glLoadIdentity (); glMultMatrixf(sbMatrixCamera[0]); before drawing my GL stuff to get the same camera view than in my OpenInventor rendering pipeline. Its working for the exception of an annoying perspective problem or Viewport Ratio problem and I dont know how to solve it. I invite you to take a look at the problem by looking at a small video you can find at: http://www.netchilds.com/Louis/test.mpeg (If everything worked correctly, you could see only one plane and one 6 DOF mechanism but its not the case. You will notice I have the same problem with perpective and ortho camera.) If you know how to solve the problem, what matrix or GL call I should be using please message me todumais01@gmc.ulaval.ca . I'm including the code below I'm using in the video to give you a better idea of my problem. Thank you for your help, Louis-Charles Dumais The Drawing loop of the gl windows: void Fl_Inventor_Window::draw() { adjustCameraClippingPlanes(); scenemanager->render(); glDraw(); glFlush(); } and my glDraw command: void Fl_Inventor_Window::glDraw(){ glMatrixMode( GL_PROJECTION ); glLoadIdentity(); SbViewVolume cameraSbViewVolume; cameraSbViewVolume = camera->getViewVolume(); SbMatrix sbMatrixCamera; sbMatrixCamera= cameraSbViewVolume.getMatrix(); glMultMatrixf(sbMatrixCamera[0]); glEnable(GL_DEPTH_TEST); //start of dump lightning GLfloat LightAmbient[]= { 0.75f, 0.75f, 0.75f, 1.0f }; //GLfloat LightAmbient[]= { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat LightDiffuse1[]= { 0.0f, 1.0f, 0.0f, 1.0f }; GLfloat LightDiffuse2[]= { 1.0f, 0.0f, 0.0f, 1.0f }; GLfloat LightPosition1[]= { 1.0f, 0.0f,0.0f, 1.0f }; GLfloat LightPosition2[]= { -1.0f, 0.0f,0.0f, 1.0f }; //GLfloat LightPosition[]= { -1.0f, 0.0f, 0.0f, 1.0f }; //GLfloat LightPosition1[]= {tempSbVec3fPos[0], tempSbVec3fPos[1], tempSbVec3fPos[2],1.0f}; //GLfloat LightPosition2[]= {tempSbVec3fPos[0], -tempSbVec3fPos[1], tempSbVec3fPos[2],1.0f}; glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // glLightfv(GL_LIGHT3, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT3, GL_DIFFUSE, LightDiffuse1); glLightfv(GL_LIGHT3, GL_POSITION,LightPosition1); glEnable(GL_LIGHT3); glLightfv(GL_LIGHT4, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT4, GL_DIFFUSE, LightDiffuse2); glLightfv(GL_LIGHT4, GL_POSITION,LightPosition2); glEnable(GL_LIGHT4); //end of dump lightning glDisable(GL_LIGHTING); //the multicolor quad glBegin(GL_QUADS); glColor3f(0.05f,0.0f,0.0f); glVertex3f( 0.0f, 0.0f, 0.0f); glColor3f(-0.5f,1.0f,0.0f); glVertex3f(0.05f,0.0f, 0.0f); glColor3f(0.0f,0.0f,1.0f); glVertex3f( 0.05f,0.0f, 0.10f); glColor3f(1.0f,0.0f,1.0f); glVertex3f( 0.0f,0.0f, 0.10f); glEnd(); //the pink quad glColor3f(1.0f,0.0f,1.0f); glBegin(GL_QUADS); glVertex3f( 0.1f,0.1f, 0.0f); glVertex3f( -0.1f,0.1f, 0.0f); glVertex3f( -0.1f,-0.1f, 0.0f); glVertex3f( 0.1f,-0.1f, 0.0f); glEnd(); //now redrawing the openinventor object to show the difference if( sceneRoot ) { sceneRoot->removeChild(camera); } SbViewportRegion myViewport(w(), h()); SoGLRenderAction myRenderAction(myViewport); myRenderAction.apply(sceneRoot); if( camera ) { sceneRoot->insertChild(camera, 1); } } From monty@gg.caltech.edu Tue Nov 9 18:03:09 2004 Received: with ECARTIS (v1.0.0; list info-inventor); Tue, 09 Nov 2004 18:03:15 -0800 (PST) Received: from muggy.gg.caltech.edu (monty@muggy.gg.caltech.edu [131.215.129.14]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iAA23981012072 for ; Tue, 9 Nov 2004 18:03:09 -0800 Received: from muggy.gg.caltech.edu (monty@localhost) by muggy.gg.caltech.edu (8.9.3 (PHNE_18979)/8.9.3) with ESMTP id SAA12464; Tue, 9 Nov 2004 18:02:49 -0800 (PST) Message-Id: <200411100202.SAA12464@muggy.gg.caltech.edu> Reply-to: monty@druggist.gg.caltech.edu X-Secret: Congratulations, you found the secret message. X-URL: http://www.gg.caltech.edu/~monty/monty.shtml X-PGP-Fingerprint: E4 EA 6D B1 82 46 DB A1 B0 FF 60 B9 F9 5D 5C F7 X-Face: ;XP1'D'Y7hP0IDW,()+Au)M`LZuSzXBcB1OJaU"gRtYuy X-archive-position: 104 X-ecartis-version: Ecartis v1.0.0 Sender: info-inventor-bounce@oss.sgi.com Errors-to: info-inventor-bounce@oss.sgi.com X-original-sender: monty@gg.caltech.edu Precedence: bulk X-list: info-inventor For recent versions of inventor under linux (both debian and red hat enterprise) and I think mac OSX (but I can't check that easily right now) I'm finding that all text (SoText2 and SoText3) is invisible. There are no complaints about missing fonts or failures; I just don't see anything. This is true many of the Mentor examples, in ivview, and in my own programs. I suspect I am missing something obvious, but I didn't see anything in the bug tracking system or the mailing list archives about this... The machine I'm testing on now is running the rpms of sgi-OpenInventor-{clients,data,devel}-2.1.5-10 I believe I am seeing the same issue with debian's packages of 2.1.5-10-3. Sorry if (as I suspect) this is a stupid question, but I'm stumped. thanks - M -- Mark "Monty" Montague | monty@gg.caltech.edu | I don't do Windows(tm) If a tree falls when there's no one observing, does its wave function collapse? X-PGP-Fingerprint: E4 EA 6D B1 82 46 DB A1 B0 FF 60 B9 F9 5D 5C F7 From jlim@kinabalu.csd.sgi.com Tue Nov 9 18:27:21 2004 Received: with ECARTIS (v1.0.0; list info-inventor); Tue, 09 Nov 2004 18:27:25 -0800 (PST) Received: from omx2.sgi.com (omx2-ext.sgi.com [192.48.171.19]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iAA2RL51014001 for ; Tue, 9 Nov 2004 18:27:21 -0800 Received: from kinabalu.csd.sgi.com (kinabalu.csd.sgi.com [134.16.212.96]) by omx2.sgi.com (8.12.11/8.12.9/linux-outbound_gateway-1.1) with ESMTP id iAA3hX1b032676 for ; Tue, 9 Nov 2004 19:43:33 -0800 Received: from kinabalu.csd.sgi.com (localhost.csd.sgi.com [127.0.0.1]) by kinabalu.csd.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id iAA2QSMB323638; Tue, 9 Nov 2004 18:26:48 -0800 (PST) Received: (from jlim@localhost) by kinabalu.csd.sgi.com (SGI-8.12.5/8.12.5/Submit) id iAA2Pvfh325183; Tue, 9 Nov 2004 18:25:57 -0800 (PST) From: Jonathan Lim Message-Id: <200411100225.iAA2Pvfh325183@kinabalu.csd.sgi.com> Subject: Re: text rendering problems To: monty@gg.caltech.edu Date: Tue, 9 Nov 2004 18:25:57 -0800 (PST) Cc: info-inventor@oss.sgi.com In-Reply-To: <200411100202.SAA12464@muggy.gg.caltech.edu> from "Mark Montague" at Nov 09, 2004 06:02:49 PM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-archive-position: 105 X-ecartis-version: Ecartis v1.0.0 Sender: info-inventor-bounce@oss.sgi.com Errors-to: info-inventor-bounce@oss.sgi.com X-original-sender: jlim@sgi.com Precedence: bulk X-list: info-inventor On Tue Nov 9 18:02:49 2004, monty@gg.caltech.edu wrote: > > For recent versions of inventor under linux (both debian and red hat > enterprise) and I think mac OSX (but I can't check that easily right > now) I'm finding that all text (SoText2 and SoText3) is > invisible. There are no complaints about missing fonts or failures; I > just don't see anything. This is true many of the Mentor examples, in > ivview, and in my own programs. > > I suspect I am missing something obvious, but I didn't see anything in > the bug tracking system or the mailing list archives about this... > > The machine I'm testing on now is running the rpms of > sgi-OpenInventor-{clients,data,devel}-2.1.5-10 > > I believe I am seeing the same issue with debian's packages of > 2.1.5-10-3. Refer to the note in the README.FIRST file about using the default font library versus the FreeType interface. If you're using the latter, try setting the environment variable FL_DEBUG to 1 before running the program. I'm using freetype-2.1.3-6 on Red Hat Linux 9 and it works fine. Jonathan From monty@gg.caltech.edu Tue Nov 9 18:44:21 2004 Received: with ECARTIS (v1.0.0; list info-inventor); Tue, 09 Nov 2004 18:44:24 -0800 (PST) Received: from muggy.gg.caltech.edu (monty@muggy.gg.caltech.edu [131.215.129.14]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iAA2iLtZ014241 for ; Tue, 9 Nov 2004 18:44:21 -0800 Received: from muggy.gg.caltech.edu (monty@localhost) by muggy.gg.caltech.edu (8.9.3 (PHNE_18979)/8.9.3) with ESMTP id SAA25116; Tue, 9 Nov 2004 18:44:01 -0800 (PST) Message-Id: <200411100244.SAA25116@muggy.gg.caltech.edu> To: Jonathan Lim Cc: info-inventor@oss.sgi.com Subject: Re: text rendering problems References: <200411100225.iAA2Pvfh325183@kinabalu.csd.sgi.com> Reply-To: monty@gg.caltech.edu Original-Original-Sender: monty@gg.caltech.edu From: Mark Montague In-Reply-To: Jonathan Lim's message of "Tue, 9 Nov 2004 18:25:57 -0800 (PST)" X-Mailer: Gnus v5.5/Emacs 20.3 Date: Tue, 09 Nov 2004 18:44:00 -0800 X-archive-position: 106 X-ecartis-version: Ecartis v1.0.0 Sender: info-inventor-bounce@oss.sgi.com Errors-to: info-inventor-bounce@oss.sgi.com X-original-sender: monty@gg.caltech.edu Precedence: bulk X-list: info-inventor Jonathan Lim writes: > Refer to the note in the README.FIRST file about using the default > font library versus the FreeType interface. If you're using the > latter, try setting the environment variable FL_DEBUG to 1 before > running the program. > > I'm using freetype-2.1.3-6 on Red Hat Linux 9 and it works fine. Thanks. It looks like this system just didn't have appropriate fonts-- when I copied some over and made the links described in inventor/libFL/ang/README things seem to work OK. It seems like it might be desirable to print out a warning if it can't find a font, rather than just silently failing to draw anything... Anyway, thanks for the pointers. - M -- Mark "Monty" Montague | monty@gg.caltech.edu | I don't do Windows(tm) If a tree falls when there's no one observing, does its wave function collapse? X-PGP-Fingerprint: E4 EA 6D B1 82 46 DB A1 B0 FF 60 B9 F9 5D 5C F7