Re: Question regarding OpenGL implementation in TORCS
David Savinkoff <[email protected]> Tue, 9 May 2017 15:31:03 -0600 (MDT)
| Newsgroups | gmane.games.torcs.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, I remembered that a documentation package was once mentioned by Bernhard. Here it is: https://sourceforge.net/projects/torcs/files/api-docs/1.3.7/ https://sourceforge.net/projects/torcs/files/api-docs/1.3.7/torcs-1.3.7-apidoc.tar.bz2/download To see the contents without navigating a huge directory: (extract archive, then view) tar -xjvf torcs-1.3.7-apidoc.tar.bz2 firefox torcs-1.3.7-apidoc/index.html ----- Konstantin Ritt wrote: > 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 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.* ) > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot