The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.31 (Linux)
|
PyGTK track editor idea - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Community (https://www.vdrift.net/Forum/forumdisplay.php?fid=3) +--- Forum: Cars & Tracks (https://www.vdrift.net/Forum/forumdisplay.php?fid=11) +--- Thread: PyGTK track editor idea (/showthread.php?tid=517) |
- rookie1 - 04-22-2007 Commited into the pygtk track editor branch. You need to use scons to build the export module vdrift.so. This module is imported into Python in vdrift-track-editor.py. The Boost.Python wrapping is done in src/wrapper.cpp. - thelusiv - 04-25-2007 I still haven't had a chance to look at this yet, I've been very busy...could you be more specific with what I need to do with SCons? Would it be obvious if I actually looked at it? - rookie1 - 04-27-2007 Well, just type 'scons' at the pygtk-trackeditor directory to build the export module vdrift.so. After that, you can start the track editor Python script as you used to. The scons script is a very simple one. You can certainly look at it if you want. - thelusiv - 04-29-2007 Did you add some new libraries? I tried it out and got it to compile after installing boost, but now the program won't run, I get: Code: There was a problem including a library. - rookie1 - 04-29-2007 GLScene is defined in gtk.gtkgl.apputils, which is part of python-gtkglext1. Did you install this package? - rookie1 - 04-30-2007 I've made some progress today (r53). Track geometry is displayed in the 3D window. You can drag the mouse to move camera around the scene. Seems texture mapping and lighting are not working. Just black shapes. - joevenzon - 04-30-2007 Just some general comments (trying to be helpful): lighting and textures have a lot to do with the opengl state. If you're basing the editor code on the game code, beware that the opengl state is poorly managed, so you might want to either 1) tear out the opengl state stuff and replace it with simpler code, if you don't need to be fancy (enable lighting, enable texturing, done) or 2) integrate the new scenegraph code i'm planning on adding in a week or two (it's my highest priority project at the moment) which will clean up and consolidate all of the opengl state management. - rookie1 - 04-30-2007 In fact the opengl init code is done in python, instead of using the existing function in main.cpp. The code for enabling lighting and texture are already present. Not sure why it's not working. Must be something i've missed. - rookie1 - 05-01-2007 Upon further investigation, texture mapping seems to work. When i move the camera close to ground, the ground texture is visible but very dark. Looks like lighting is the problem. This is a screen shot of Ruudskogen. - rookie1 - 05-03-2007 Finally, the track is displayed correctly. The problem turns out to be a call to enable GL_FOG in OBJECTS:raw(). After comment out this line, the display works. :lol: I've attached a screenshot of Laguna Seca at the end. Now something to discuss, if you look at the pygtk-trackeditor directory, I've copied the required source files and include files from vdrift and made some modifications for the compilation to be successful. We will run into out-of-sync problems sooner or later between pygtk-trackeditor and vdrift mainline code. To solve this problem, I've modified vdrift scons scripts to add another target called 'wrapper'. This will build an export module (shared library) called vdrift.so in vdrift build directory. To run the pygtk-trackeditor, simply copy this file to the track editor directory. There are minimal changes to vdrift mainline code, 1. scons script change to add new target 2. add a wrapper.cpp in src/ 3. couple of conditional compilation in objects.cpp (e.g. do not call glEnable(GL_FOG) if we are building the wrapper) So, what do you say? Can I commit the changes to vdrift mainline? Now for the screen shot - protomor - 05-03-2007 omfg whens this going to be done! or at least a doable beta? - thelusiv - 05-04-2007 protomor, we'd like it to be done as soon as possible, of course. Hopefully it will be somewhat functional some time before we do the next VDrift release. rookie1, the screenshot looks fantastic, thanks for your work on this! Also, I can't see why the changes you propose to make to trunk will have any adverse effects. Do you know of any problems these changes will trigger? If not, I think you can go ahead and commit. -------------- The following is not really related to VDrift, but more about my problems trying to get pygtkglext working on Ubuntu Feisty 64. The reason I'm posting the info is for others who might be having the same problem and maybe this will help someone find a solution. If you wish to save time and skip it, just start reading again after the next dashed line.... I finally got around to trying this out tonight, since I'm finally done with exams. Unfortunately I couldn't get it to work on my development machine. It's running Ubuntu Feisty for AMD64, and there was no package for it available. I tried the amd64 .deb from Debian unstable, but it wouldn't work (complained that I didn't have python package version 2.4). So of course I headed over to the GtkGlExt home page and picked up the latest source package for pygtkglext. Running setup.py didn't work for me, even with python2.4: Code: thelusiv@deuxeau:~/code/pygtkglext-1.1.0$ python2.4 setup.py install --prefix=/usr Code: thelusiv@deuxeau:~/code/pygtkglext-1.1.0$ python2.4 setup.py install --prefix=/usr OK, so that's not going to work. Giving up on setup.py I see there is an autotools setup too, so I run ./configure --prefix=/usr and it works, as does make and sudo make install. This installed files that looked like the ones I needed to /usr/lib/python2.5/site-packages/gtk-2.0/gtk/gtkgl . Now I'm getting somewhere...but sadly it still doesn't work. Trying to import the library by all different names, I finally moved the gtkgl directory down to /usr/lib/python2.5/site-packages/ and tried: Code: thelusiv@deuxeau:~/code/vdrift-trackeditor/branches/pygtk-trackeditor$ python Giving up on python 2.5, I move the directory to /usr/lib/python2.4/site-packages and try: Code: thelusiv@deuxeau:~/code/vdrift-trackeditor/branches/pygtk-trackeditor$ python2.4 ----------------- So, back to my old 32-bit development machine running Ubuntu Edgy which has a package for pygtkglext, it runs fine. I am trying to stop using that computer, but damn it, it's so useful. Now that I actually got it running I have started playing around with the code and made a few changes. I didn't find it very easy to move around the way the camera controls were set up. The changes I made are detailed in the commit log message. rookie1, let me know if you don't like any of the changes I made. An issue introduced by my changes is that now the user can't control camera up/down movement. I think the best way to address this would be to make the camera always float a certain distance above the track and other objects beneath it. I think I can get this information from the track objects that have been loaded, but haven't tried this yet. Joe, or anyone else who might know how to do this, feel free to chime in. I'll probably work on this a little more tomorrow and over the weekend. Another thing that is pretty important is the ability to select objects by clicking on them. I'd like to get this working as well. We'll also need to set up a similar way to select objects' vertices so that the track surface can be defined. Left mouse click would probably work great for both of these, with a menu/toolbar toggle to switch between vertex/object selection mode. There's a lot more stuff I have in mind but this post is already long and I'm tired, so more later. Anyway, great work rookie1, this track editor is now officially off to a good start. :mrgreen: - rookie1 - 05-04-2007 I've committed the changes to vdrift and pygtk-trackeditor. I've added a README file in pygtk-trackeditor to give instructions on how to use it. Some changes i've made - now you need to click open button to load a track. the editor do not auto load the default track any more. - all the track objects are listed at the left pane. I've no problem with the mouse control change. In fact it was added mainly to help me debug the display problem. So it has not been properly planed out. Just a suggestion, maybe we can use Ctrl-mouse drag to move up/down? - joevenzon - 05-04-2007 To find the height of the track at a given position, use TRACK::Elevation(VERTEX origin) Do do mouse picking of objects you'll need the following function: bool OBJECTS::Collide(VERTEX origin, VERTEX direction, VERTEX &outtri, bool closest, VERTEX & normal, float seglen, OBJECTNODE * &colnode); You give that function a ray segment (origin plus a normalized direction vector plus the ray length seglen), and you get back a collision point VERTEX (outtri), the normal of the collision point (normal), and a pointer to the OBJECTNODE (colnode) which is the object class. You can set closest to whatever works. It's supposed to toggle whether or not you get the closest collision or don't care, but I don't remember if it's working or not. Just use whatever value works. - thelusiv - 05-05-2007 rookie1, your changes work OK for me. I just build the vdrift wrapper with "scons wrapper" and copy the .so file (or symlink it ). I've checked in some improvements to the open track dialog. It now uses the FileChooserDialog instead of the FileSelection widget, and only allows selection of folders. Also I hooked up the File -> Open menu entry. There were also a few bugs with the track window trying to display when a track was not loaded, which I fixed. |