- joevenzon - 04-28-2010
Just noticed that since the rewrite shadows are broken for all shadow casters except the car.
- joevenzon - 04-28-2010
Shadows are fixed in R2694.
- NaN - 04-28-2010
I did a quick test(2695) and hit a segfault on game restart.
The stack trace:
Code: #0 004CA82D RENDER_INPUT_SCENE::SelectTexturing(this=0x28afa8, forme=..., glstate=...) (E:\vdrift\vdrift\src\graphics_renderers.cpp:504)
#1 004C9CB6 RENDER_INPUT_SCENE::DrawList(this=0x28afa8, glstate=..., drawlist=..., preculled=true) (E:\vdrift\vdrift\src\graphics_renderers.cpp:236)
#2 004C9BDC RENDER_INPUT_SCENE::Render(this=0x28afa8, glstate=...) (E:\vdrift\vdrift\src\graphics_renderers.cpp:211)
#3 004C8870 GRAPHICS_SDLGL::Render(this=0x28aba4, input=0x28afa8, output=..., error_output=...) (E:\vdrift\vdrift\src\graphics.cpp:968)
#4 004C7B03 GRAPHICS_SDLGL::RenderDrawlists(this=0x28aba4, dynamic_drawlist=..., static_drawlist=..., render_scene=..., render_output=..., error_output=...) (E:\vdrift\vdrift\src\graphics.cpp:887)
#5 004C5B34 GRAPHICS_SDLGL::DrawScene(this=0x28aba4, error_output=...) (E:\vdrift\vdrift\src\graphics.cpp:603)
#6 004BFDCB GAME::LoadingScreen(this=0x28a770, progress=0, max=1) (E:\vdrift\vdrift\src\game.cpp:2116)
#7 004BBF84 GAME::LoadTrack(this=0x28a770, trackname=...) (E:\vdrift\vdrift\src\game.cpp:1760)
#8 004BA2CB GAME::NewGame(this=0x28a770, playreplay=false, addopponents=false, num_laps=0) (E:\vdrift\vdrift\src\game.cpp:1512)
#9 004B86A0 GAME::ProcessGUIAction(this=0x28a770, action=...) (E:\vdrift\vdrift\src\game.cpp:1306)
#10 004B4C52 GAME::ProcessGUIInputs(this=0x28a770) (E:\vdrift\vdrift\src\game.cpp:1023)
#11 004B246B GAME::AdvanceGameLogic(this=0x28a770) (E:\vdrift\vdrift\src\game.cpp:622)
#12 004B236D GAME::Tick(this=0x28a770, deltat=0.00700000022) (E:\vdrift\vdrift\src\game.cpp:606)
#13 004B221D GAME::MainLoop(this=0x28a770) (E:\vdrift\vdrift\src\game.cpp:572)
#14 004AE2F9 GAME::Start(this=0x28a770, args=...) (E:\vdrift\vdrift\src\game.cpp:175)
#15 004F716F SDL_main(argc=2, argv=0x28fd40) (E:\vdrift\vdrift\src\main.cpp:70)
#16 0052C716 console_main(argc=2, argv=0x28fd40) (src/main/win32/SDL_win32_main.c:217)
#17 0052C8D7 WinMain(hInst=0x400000, hPrev=0x0, szCmdLine=0x22830dc "-debug", sw=10) (src/main/win32/SDL_win32_main.c:353)
#18 00000000 0x0052c180 in main() (??:??)
- joevenzon - 04-28-2010
Pretty sure this was because I wasn't clearing the culling tree when the track was unloaded. I think this should be fixed in R2697.
- NaN - 04-28-2010
Yep, this was it. Segfault is gone in 2697.
- NaN - 04-29-2010
@joevenzon
To add car skin/color support I would like to switch to a common content manager. It would keep track of loaded/used content like TEXTURE, SOUND, MODEL(VERTEXARRAY) and (re)load them on demand. But this means changes in the affected classes and DRAWABLE (replacing raw pointers with shared_ptr and modifying the interfaces). What do you think?
- joevenzon - 05-01-2010
NaN Wrote:I would like to switch to a common content manager. It would keep track of loaded/used content like TEXTURE, SOUND, MODEL(VERTEXARRAY) and (re)load them on demand. But this means changes in the affected classes and DRAWABLE (replacing raw pointers with shared_ptr and modifying the interfaces). What do you think?
Just don't make the common content manager a global or singleton or anything -- instead, pass a reference to the appropriate content manager object into the loader functions. Were you thinking you'd make a generic (templated) content manager class, then instances for TEXTURE, SOUND, etc? If so, sounds great.
The DRAWABLE changes are fine. Please use the tr1 shared_ptr.
- NaN - 05-03-2010
The templated manager is a weak_ptr map. Any managed object has to have a constructor that takes an info class as parameter. The object info is used as key and to create(load) the object.
I started to adapt the code. The first step is to move textures into a texture manager.
One thing I stumbled upon is std::ostream & error_output passed to a lot of functions to gather the error state. Is there anything hindering us from using std::cerr instead, like we do at some places already.
- joevenzon - 05-05-2010
I don't like using globally accessible state from many unrelated places. Having values passed into functions allows me to make one change further up (say, sending error output for a subsystem to a different file) and have it instantly working. It also keeps classes modular because they don't depend on that globally accessible state (for example, if cerr were used as the program's error logger it would require a rewrite to take model loading code and use it in a GUI program where cerr isn't an appropriate error output).
Granted, sticking to that philosophy for something as ubiquitous as error logging can be tough. If it makes it simpler, then just initialize your resource manager with an error_output ostream pointer once instead of passing error_output in with each resource load call (I assume that's where you're running into trouble).
- NaN - 05-06-2010
I've got the texture manager running. There is one issue to be fixed(before check in). It looks like I am deleting the textures at the wrong place:
Code: "Texture ID deletion (../vdrift-data/tracks/rouen/objects/road1a.bmp.png)"
PS: Some debug output(loading ruudskogen ). One object reference is kept in the manager.
Code: Texture manager debug print:
References: 56 Texture: ../vdrift-data/skins/simple/textures/box.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/timerbox.png
References: 3 Texture: ../vdrift-data/cars/360/textures/wheel_rear.png
References: 2 Texture: ../vdrift-data/cars/360/textures/brake.png
References: 4 Texture: ../vdrift-data/skins/simple/textures/progressbar.png
References: 4 Texture: ../vdrift-data/tracks/ruudskogen/objects/ruudskog.tga.png
References: 24 Texture: ../vdrift-data/tracks/ruudskogen/objects/road03.jpg.png
References: 59 Texture: ../vdrift-data/skins/simple/textures/widgets/controls/key_sel.png
References: 2 Texture: ../vdrift-data/textures/hud/cardot0_focused.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/objects/lave01.bmp.png
References: 2 Texture: ../vdrift-data/textures/smoke/particle1.png
References: 21 Texture: ../vdrift-data/skins/simple/textures/widgets/sld_cursor.png
References: 3 Texture: ../vdrift-data/skins/simple/textures/hudbox.png
References: 13 Texture: ../vdrift-data/skins/simple/textures/widgets/controls/mouse.png
References: 12 Texture: ../vdrift-data/tracks/ruudskogen/objects/road01.jpg.png
References: 2 Texture: ../vdrift-data/textures/smoke/particle5.png
References: 42 Texture: ../vdrift-data/skins/simple/textures/widgets/tog_on_up.png
References: 2 Texture: ../vdrift-data/textures/hud/cardot0.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/objects/grid02.tga.png
References: 2 Texture: ../vdrift-data/skins/simple/fonts/freesans_noshaders.png
References: 3 Texture: ../vdrift-data/tracks/ruudskogen/objects/grass02.jpg.png
References: 15 Texture: ../vdrift-data/tracks/ruudskogen/objects/auto01.tga.png
References: 23 Texture: ../vdrift-data/tracks/ruudskogen/objects/grass01.jpg.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/trackshot.png
References: 37 Texture: ../vdrift-data/skins/simple/textures/widgets/wheel_down_l.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/accdec-marker.png
References: 2 Texture: ../vdrift-data/textures/smoke/particle4.png
References: 2 Texture: ../vdrift-data/cars/360/textures/glass.png
References: 5 Texture: ../vdrift-data/tracks/ruudskogen/objects/sand01.jpg.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/objects/hus02.tga.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/loadingbox.png
References: 42 Texture: ../vdrift-data/skins/simple/textures/widgets/tog_on_up_unsel.png
References: 4 Texture: ../vdrift-data/tracks/ruudskogen/objects/dekk01.bmp.png
References: 20 Texture: ../vdrift-data/tracks/ruudskogen/objects/tre06.bmp.png
References: 42 Texture: ../vdrift-data/skins/simple/textures/widgets/tog_off_down.png
References: 2 Texture: ../vdrift-data/textures/smoke/particle3.png
References: 2 Texture: ../vdrift-data/textures/hud/cardot1.png
References: 73 Texture: ../vdrift-data/skins/simple/textures/widgets/wheel_up_l.png
References: 2 Texture: ruudskogen
References: 37 Texture: ../vdrift-data/skins/simple/textures/widgets/wheel_down_r.png
References: 2 Texture: ../vdrift-data/drivers/driver2/textures/body.png
References: 7 Texture: ../vdrift-data/tracks/ruudskogen/objects/gjerde01.tga.png
References: 42 Texture: ../vdrift-data/skins/simple/textures/widgets/tog_off_up_unsel.png
References: 723 Texture: ../vdrift-data/skins/simple/fonts/futuresans_noshaders.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/objects/grid01.tga.png
References: 547 Texture: ../vdrift-data/textures/effects/racingline.png
References: 2 Texture: ../vdrift-data/textures/smoke/particle0.png
References: 2 Texture: ../vdrift-data/drivers/driver2/textures/body-misc1.png
References: 3 Texture: ../vdrift-data/tracks/ruudskogen/objects/kollisjon02.dof-00.png
References: 42 Texture: ../vdrift-data/skins/simple/textures/widgets/tog_off_up.png
References: 2 Texture: ../vdrift-data/textures/smoke/particle2.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/objects/lave02.bmp.png
References: 18 Texture: ../vdrift-data/tracks/ruudskogen/objects/Tre10.bmp.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/ball2.png
References: 86 Texture: ../vdrift-data/skins/simple/textures/widgets/controls/add.png
References: 2 Texture: ../vdrift-data/cars/360/textures/interior.png
References: 2 Texture: ../vdrift-data/cars/360/textures/body-misc1.png
References: 3 Texture: ../vdrift-data/skins/simple/textures/loadingbar.png
References: 171 Texture: ../vdrift-data/skins/simple/textures/widgets/controls/add_sel.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/accdec-slider.png
References: 73 Texture: ../vdrift-data/skins/simple/textures/widgets/wheel_up_r.png
References: 10 Texture: ../vdrift-data/tracks/ruudskogen/objects/road02.jpg.png
References: 3 Texture: ../vdrift-data/tracks/ruudskogen/objects/hytte01.bmp.png
References: 2 Texture: ../vdrift-data/cars/360/textures/body00.png
References: 7 Texture: ../vdrift-data/tracks/ruudskogen/objects/skilt01.jpg.png
References: 25 Texture: ../vdrift-data/skins/simple/textures/widgets/controls/mouse_sel.png
References: 2 Texture: ../vdrift-data/cars/360/textures/reverse.png
References: 2 Texture: ../vdrift-data/cars/360/textures/glass-misc1.png
References: 21 Texture: ../vdrift-data/skins/simple/textures/widgets/sld_wedge.png
References: 30 Texture: ../vdrift-data/skins/simple/textures/widgets/controls/key.png
References: 27 Texture: ../vdrift-data/skins/simple/fonts/lcd_noshaders.png
References: 2 Texture: ../vdrift-data/tracks/rouen/trackshot.png
References: 144 Texture: ../vdrift-data/skins/simple/textures/widgets/btn_up_unsel.png
References: 2 Texture: ../vdrift-data/tracks/ruudskogen/objects/himmel03.jpg.png
References: 144 Texture: ../vdrift-data/skins/simple/textures/widgets/btn_down.png
References: 2 Texture: ../vdrift-data/textures/hud/cardot1_focused.png
References: 23 Texture: ../vdrift-data/tracks/ruudskogen/objects/busk01.bmp.png
References: 3 Texture: ../vdrift-data/cars/360/textures/wheel_front.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/logo.png
References: 22 Texture: ../vdrift-data/tracks/ruudskogen/objects/tre02.bmp.png
References: 144 Texture: ../vdrift-data/skins/simple/textures/widgets/btn_up.png
References: 2 Texture: ../vdrift-data/skins/simple/textures/slider2.png
References count: 2932
Objects count: 82, created: 44, reused: 186, deleted: 7
- NaN - 05-06-2010
Found the reason for the OpenGL error. Some textures are released after SDL_Quit():
Code: Texture ID deletion (../vdrift-data/skins/simple/textures/widgets/controls/key.png)
Texture ID deletion (../vdrift-data/skins/simple/textures/timerbox.png)
Texture ID deletion (../vdrift-data/skins/simple/textures/loadingbox.png)
...
The issue has been there before my changes. A number of widgets keep their texture until their destruction, which happens after SDL_Quit() call.
- NaN - 05-07-2010
Sorry to hijack your thread Joe.
I've started to integrate car coloring( http://vdrift.net/Forum/viewtopic.php?t=1325 ). My current idea is to create the car texture from color.png + rgb + bodyXX.png in software(using SDL). The alternative would be to add another texture to drawable and do it in the shader. I am not sure which approach is more appealing. What do you think? (I am too lazy to implement both, but I maybe will have to.)
- joevenzon - 05-07-2010
NaN Wrote:Sorry to hijack your thread Joe. No problem. :-)
Quote:I've started to integrate car coloring( http://vdrift.net/Forum/viewtopic.php?t=1325 ). My current idea is to create the car texture from color.png + rgb + bodyXX.png in software(using SDL). The alternative would be to add another texture to drawable and do it in the shader. I am not sure which approach is more appealing. What do you think? (I am too lazy to implement both, but I maybe will have to.)
I think the color selection part during car select would benefit from having it done in the shader, because then you could show updates immediately. I like the software idea because it reduces texture assets and texture units required, though... but with a lot of similar cars, the shader way is better again. So... not clear to me which is better. I've leaning toward the shader way. Maybe do whichever is easier? :?
- alex25 - 05-07-2010
we lost the mouse grab, again. what the... this is the second time this is happening. i wonder what else got lost this time. i fixed this in svn, but can we please stop committing spurious changes? thanks.
--alex--
- NaN - 05-07-2010
The software implementation will also work for non-shader configurations. But I am not sure if it is going to be fast enough. It surely will depend on texture size.
There might be a third option. Using render to texture + shader to bake the car texture. But for this I need to be able to load the custom shader and render the texture(outside of the scenegraph). The good thing is that I'll need this functionality for the dynamic sky anyway.
|