Re: Question regarding OpenGL implementation in TORCS
Konstantin Ritt <[email protected]> Tue, 9 May 2017 19:02:46 +0200
| Newsgroups | gmane.games.torcs.general |
|---|---|
| Message-ID | <CAG-GN6qG=+BvAdxWvR6FDvHKT5WQuSDuyZT6BxK=0ZitTwEgPg@mail.gmail.com> |
--===============5240382151843019130== Content-Type: multipart/alternative; boundary=001a114e568a330d7f054f1a5391 --001a114e568a330d7f054f1a5391 Content-Type: text/plain; charset=UTF-8 Hi, Thanks David for your hint. I am still struggling to find my way through to the right file(s) or method(s). I actually identified different files as being important to the rendering of the driving/game scenes, such as src/modules/graphic/ssggraph/grmain.cpp and grscreen.cpp where the actual drawing happens. I want to state again what I am trying to achieve, maybe someone can direct me into the right direction then. My goal is to create a FBO (frame buffer object) that is connected to a texture unit. To this texture unit I want to render the frames to perform post processing. I found that the central rendering happens in the following manner: - src/libs/raceengineclient/raceengine.cpp int ReUpdate(void) calls ReInfo->_reGraphicItf.refresh(ReInfo->s) to update the current situation s - src/modules/graphic/ssggraph/grmain.cpp contains this refresh function. In this refresh function it is iterated through all active screens by calling grScreens[i]->update - src/modules/graphic/ssggraph/grscreen.cpp contains this update function. camDraw is called (same class) which again calls grDrawScene() - src/modules/graphic/ssggraph/grscene.cpp contains this grDrawScene function, where the whole scene is passed to ssgCullAndDraw to be rendered. In the beginning of grmain.cpp: refresh(Situation s) I set up the FBO. All rendering should be performed to the texture of the FBO then (tested all this with a smaller application). After the call to grScreens[0]->update(s, grFps) I unbind the FBO and (currently) use the information from the FBO texture to render back to the screen. However, only some textures (of trees, grass etc.) make it to the texture in the FBO, but not the whole scene. Any ideas what and where it could go wrong? I can gladly share the implementation of the FBO as well, but as stated above, I tested the principle of the FBO with a simple application and got it working. I therefore think the problem lies in my limited understanding of the Torcs OpenGL pipeline and that I did not place it correctly. Cheers and thanks for all your help, Konstantin On Thu, Apr 27, 2017 at 7:52 AM, David Savinkoff <[email protected]> wrote: > ----- Konstantin Ritt wrote: > > Hello, > > > > I just starting using TORCS for my masters thesis. I am currently trying > to > > gain some knowledge about usage of OpenGL and was wondering if you could > > give a quick shout on where and how the OpenGL pipeline is handled in > TORCS? > > I don't know, but see below. > > > What I am trying to do is to create another buffer to write frames to, > as a > > texture, before they are displayed on the screen. With these textures I > > want to perform postprocessing purely by using shaders to keep all memory > > and computation on the GPU in order to reduce impact on the runtime of > the > > simulation. > > I would highly appreciate it if you could give me some short advice to > save > > me time sorting through the immense framework of TORCS. Thanks a lot in > > advance! > > > > Kind regards, > > Konstantin > > Hi, > I found that the following files have 99.99% of torcs gl code in them: > > torcs/src/libs/tgfclient/gui.cpp > torcs/src/libs/tgfclient/img.cpp > torcs/src/libs/tgfclient/screen.cpp > torcs/src/libs/tgfclient/guibutton.cpp > torcs/src/libs/tgfclient/guiedit.cpp > torcs/src/libs/tgfclient/guifont.cpp > torcs/src/libs/tgfclient/glfeatures.cpp > torcs/src/libs/tgfclient/guiscrollist.cpp > torcs/src/libs/confscreens/mouseconfig.cpp > torcs/src/libs/confscreens/joystickconfig.cpp > torcs/src/libs/confscreens/controlconfig.cpp > torcs/src/libs/raceengineclient/raceengine.cpp > torcs/src/libs/raceengineclient/racegl.cpp > torcs/src/libs/client/splash.cpp > torcs/src/libs/musicplayer/musicplayer.cpp > > ( find . -type f -print0 | xargs -0 grep -Iw gl.* ) > --001a114e568a330d7f054f1a5391 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div>Hi,<br><br></div>Thanks David for your hint. <br= ></div><div>I am still struggling to find my way through to the right file(= s) or method(s). I actually identified different files as being important t= o the rendering of the driving/game scenes, such as src/modules/graphic/ssg= graph/grmain.cpp and grscreen.cpp where the actual drawing happens. <br></d= iv><div>I want to state again what I am trying to achieve, maybe someone ca= n direct me into the right direction then. <br></div><div>My goal is to cre= ate a FBO (frame buffer object) that is connected to a texture unit. To thi= s texture unit I want to render the frames to perform post processing.<br><= /div><div>I found that the central rendering happens in the following manne= r: <br><ul><li>src/libs/raceengineclient/raceengine.cpp int ReUpdate(void) = calls ReInfo->_reGraphicItf.refresh(ReInfo->s) to update the current = situation s</li><li>src/modules/graphic/ssggraph/grmain.cpp contains this r= efresh function. In this refresh function it is iterated through all active= screens by calling grScreens[i]->update</li><li>src/modules/graphic/ssg= graph/grscreen.cpp contains this update function. camDraw is called (same c= lass) which again calls grDrawScene()</li><li>src/modules/graphic/ssggraph/= grscene.cpp contains this grDrawScene function, where the whole scene is pa= ssed to ssgCullAndDraw to be rendered.=C2=A0</li></ul><p>In the beginning o= f grmain.cpp: refresh(Situation s) I set up the FBO. All rendering should b= e performed to the texture of the FBO then (tested all this with a smaller = application). <br></p><p>After the call to grScreens[0]->update(s, grFps= ) I unbind the FBO and (currently) use the information from the FBO texture= to render back to the screen. However, only some textures (of trees, grass= etc.) make it to the texture in the FBO, but not the whole scene.</p><p>An= y ideas what and where it could go wrong?</p><p>I can gladly share the impl= ementation of the FBO as well, but as stated above, I tested the principle = of the FBO with a simple application and got it working. I therefore think = the problem lies in my limited understanding of the Torcs OpenGL pipeline a= nd that I did not place it correctly. <br></p><p>Cheers and thanks for all = your help,</p><p>Konstantin<br></p><p><br></p></div><div><br><br></div></di= v><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Thu, Apr 27,= 2017 at 7:52 AM, David Savinkoff <span dir=3D"ltr"><<a href=3D"mailto:d= [email protected]" target=3D"_blank">[email protected]</a>></span> wrot= e:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l= eft:1px #ccc solid;padding-left:1ex"><span class=3D"">----- Konstantin Ritt= wrote:<br> > Hello,<br> ><br> > I just starting using TORCS for my masters thesis. I am currently tryi= ng to<br> > gain some knowledge about usage of OpenGL and was wondering if you cou= ld<br> > give a quick shout on where and how the OpenGL pipeline is handled in = TORCS?<br> <br> </span>I don't know, but see below.<br> <span class=3D""><br> > What I am trying to do is to create another buffer to write frames to,= as a<br> > texture, before they are displayed on the screen. With these textures = I<br> > want to perform postprocessing purely by using shaders to keep all mem= ory<br> > and computation on the GPU in order to reduce impact on the runtime of= the<br> > simulation.<br> > I would highly appreciate it if you could give me some short advice to= save<br> > me time sorting through the immense framework of TORCS. Thanks a lot i= n<br> > advance!<br> ><br> > Kind regards,<br> > Konstantin<br> <br> </span>Hi,<br> I found that the following files have 99.99% of torcs gl code in them:<br> <br> torcs/src/libs/tgfclient/gui.<wbr>cpp<br> torcs/src/libs/tgfclient/img.<wbr>cpp<br> torcs/src/libs/tgfclient/<wbr>screen.cpp<br> torcs/src/libs/tgfclient/<wbr>guibutton.cpp<br> torcs/src/libs/tgfclient/<wbr>guiedit.cpp<br> torcs/src/libs/tgfclient/<wbr>guifont.cpp<br> torcs/src/libs/tgfclient/<wbr>glfeatures.cpp<br> torcs/src/libs/tgfclient/<wbr>guiscrollist.cpp<br> torcs/src/libs/confscreens/<wbr>mouseconfig.cpp<br> torcs/src/libs/confscreens/<wbr>joystickconfig.cpp<br> torcs/src/libs/confscreens/<wbr>controlconfig.cpp<br> torcs/src/libs/<wbr>raceengineclient/raceengine.<wbr>cpp<br> torcs/src/libs/<wbr>raceengineclient/racegl.cpp<br> torcs/src/libs/client/splash.<wbr>cpp<br> torcs/src/libs/musicplayer/<wbr>musicplayer.cpp<br> <br> ( find . -type f -print0 | xargs -0 grep -Iw gl.* )<br> </blockquote></div><br></div> --001a114e568a330d7f054f1a5391-- --===============5240382151843019130== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot --===============5240382151843019130== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Torcs-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/torcs-users --===============5240382151843019130==--