home *** CD-ROM | disk | FTP | other *** search
/ ftp.xmission.com / 2014.06.ftp.xmission.com.tar / ftp.xmission.com / pub / lists / fractdev / archive / v01.n032 < prev    next >
Internet Message Format  |  2000-06-30  |  45KB

  1. From: owner-fractdev-digest@lists.xmission.com (fractdev-digest)
  2. To: fractdev-digest@lists.xmission.com
  3. Subject: fractdev-digest V1 #32
  4. Reply-To: fractdev-digest
  5. Sender: owner-fractdev-digest@lists.xmission.com
  6. Errors-To: owner-fractdev-digest@lists.xmission.com
  7. Precedence: bulk
  8.  
  9.  
  10. fractdev-digest         Friday, June 30 2000         Volume 01 : Number 032
  11.  
  12.  
  13.  
  14.  
  15. ----------------------------------------------------------------------
  16.  
  17. Date: Sun, 4 Jun 2000 16:28:43 -0500
  18. From: "Jonathan Osuch" <osuchj@uswest.net>
  19. Subject: Re: Bug fix in Xfractint 20.0.11
  20.  
  21. Scott,
  22.  
  23. > I have found the bug that kept '#' and 'F3' from selecting 3D Overlay
  24. while
  25. > at the Main Menu in Xfractint. I removed lines 1294 - 1295 in unixscr.c.
  26.  
  27. That is a routine I think I will change to be bypassed unless requested by a
  28. command line option.  It catches the control-e used by the evolver, also.
  29.  
  30. Jonathan
  31.  
  32.  
  33.  
  34. - --------------------------------------------------------------
  35. Thanks for using Fractdev, The Fractint Developer's Discussion List
  36. Post Message:   fractdev@lists.xmission.com
  37. Get Commands:   majordomo@lists.xmission.com "help"
  38. Administrator:  twegner@fractint.org
  39. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  40.  
  41. ------------------------------
  42.  
  43. Date: Tue, 27 Jun 2000 20:40:23 -0500
  44. From: "Jonathan Osuch" <osuchj@uswest.net>
  45. Subject: Allegro port status
  46.  
  47. Tim,
  48.  
  49. The latest set of source code available to you has all the menus working.
  50. The temporary messages still need a little work.
  51.  
  52. We need to work on the interface we want to use for the various graphics
  53. modes.  Currently, the built in Allegro function is used to provide a menu,
  54. but we don't need (or want?) to use it.  We could set up the command line
  55. such that something like: video=1024x768x24  would provide the resolution
  56. and the color depth.  Backwards compatibility needs to be worked out also.
  57. As does the results of pressing the function keys and what appears when the
  58. delete key is pressed.  Also, we need to consider how setting the disk video
  59. resolution will work.  We could have a menu like:
  60.  
  61. X Width           1078
  62. Y Depth           768
  63. Color Depth     24
  64.  
  65. I have a version where the palette editor (with 8 bit color) works to a
  66. certain extent.  There are sections of code that will need to be changed to
  67. get the alignment of the boxes and characters correct.
  68.  
  69. There is also a problem with displaying arrows (for which keys to use) on
  70. the screen.  This is due to using the default key mapping from Allegro.  I
  71. haven't tried to fix it yet.
  72.  
  73. Jonathan
  74.  
  75.  
  76.  
  77. - --------------------------------------------------------------
  78. Thanks for using Fractdev, The Fractint Developer's Discussion List
  79. Post Message:   fractdev@lists.xmission.com
  80. Get Commands:   majordomo@lists.xmission.com "help"
  81. Administrator:  twegner@fractint.org
  82. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  83.  
  84. ------------------------------
  85.  
  86. Date: Wed, 28 Jun 2000 13:48:33 -0600
  87. From: Phil McRevis <legalize@xmission.com>
  88. Subject: Re: Allegro port status 
  89.  
  90. In article <000d01bfe0a1$e329ff00$0100a8c0@bananasenior>,
  91.     "Jonathan Osuch" <osuchj@uswest.net>  writes:
  92.  
  93. > but we don't need (or want?) to use it.  We could set up the command line
  94. > such that something like: video=1024x768x24  would provide the resolution
  95. > and the color depth.
  96.  
  97. Specifying the depth alone isn't enough to identify various video
  98. modes of importance.  For instance, in 16-bit mode you have RGB 5:6:5
  99. and xRGB 1:5:5:5 and RGBA 5:5:5:1.
  100.  
  101. > Backwards compatibility needs to be worked out also.
  102.  
  103. Fractint currently only remembers the video mode from the function key
  104. definition.  This should be changed to specify the video mode
  105. explicitly rather than relying on the indirection through the video
  106. key mapping.
  107.  
  108. > As does the results of pressing the function keys and what appears when the
  109. > delete key is pressed.  Also, we need to consider how setting the disk video
  110. > resolution will work.
  111.  
  112. I envisioned that "disk video" mode would be just another device
  113. selected through the interface.  It can have an arbitrary pixel format
  114. for its output, since its all in software.  The larger vision was to
  115. enable the possibility of having Win32 modes and DirectX modes living
  116. side-by-side even though they are pretty different on the insides.
  117.  
  118. That's why the menuing, etc., code has to be in the driver interface
  119. - -- doing a menu under Win32 or DOS/Allegro is going to be very
  120. different from doing it under DirectX or the Mac, or Xlib, etc.
  121. - --
  122. <http://www.xmission.com/~legalize/>    Legalize Adulthood!
  123.     ``Ain't it funny that they all fire the pistol,     
  124.       at the wrong end of the race?''--PDBT     
  125. legalize@xmission.com    <http://www.xmission.com/~legalize/who/>
  126.  
  127. - --------------------------------------------------------------
  128. Thanks for using Fractdev, The Fractint Developer's Discussion List
  129. Post Message:   fractdev@lists.xmission.com
  130. Get Commands:   majordomo@lists.xmission.com "help"
  131. Administrator:  twegner@fractint.org
  132. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  133.  
  134. ------------------------------
  135.  
  136. Date: Thu, 29 Jun 2000 16:26:01 -0500
  137. From: "Jonathan Osuch" <osuchj@uswest.net>
  138. Subject: Re: Allegro port status 
  139.  
  140. Rich,
  141.  
  142. > Specifying the depth alone isn't enough to identify various video
  143. > modes of importance.  For instance, in 16-bit mode you have RGB 5:6:5
  144. > and xRGB 1:5:5:5 and RGBA 5:5:5:1.
  145.  
  146. We can certainly address this.  Since Allegro does this for us behind the
  147. scenes, your input will be invaluable in setting this up.  I take it you are
  148. suggesting something along the lines of: video=1024x768x5x6x5x0
  149.  
  150. Or, would it be cleaner to use a different command line, such as:
  151. video=1024x768 depth=5:6:5:0
  152.  
  153. > Fractint currently only remembers the video mode from the function key
  154. > definition.  This should be changed to specify the video mode
  155. > explicitly rather than relying on the indirection through the video
  156. > key mapping.
  157.  
  158. Yes, I agree.  But, in order to not break PAR's that use video=, we will
  159. still need to map those function keys to video modes.  OTOH, we could just
  160. ignore video= commands in PARs.  The problem that raises is that there are
  161. some images that are resolution dependent.
  162.  
  163. > I envisioned that "disk video" mode would be just another device
  164. > selected through the interface.  It can have an arbitrary pixel format
  165. > for its output, since its all in software.
  166.  
  167. Currently that is crudely done by recompiling.  I haven't taken a close look
  168. at how to switch from one device to another when both are memory resident.
  169.  
  170. It appears to me that the windows allowed by Allegro can also be arbitrarily
  171. sized.  Although you can run into a problem with the text being too small or
  172. off the edge of the window.
  173.  
  174. Jonathan
  175.  
  176. P.S.  If I don't respond to something you think is important it's probably
  177. because it went zinging over my head.  Please feel free to reiterate.
  178.  
  179.  
  180.  
  181. - --------------------------------------------------------------
  182. Thanks for using Fractdev, The Fractint Developer's Discussion List
  183. Post Message:   fractdev@lists.xmission.com
  184. Get Commands:   majordomo@lists.xmission.com "help"
  185. Administrator:  twegner@fractint.org
  186. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  187.  
  188. ------------------------------
  189.  
  190. Date: Thu, 29 Jun 2000 17:54:22 -0600
  191. From: Phil McRevis <legalize@xmission.com>
  192. Subject: Re: Allegro port status 
  193.  
  194. In article <000901bfe210$aaca4500$0100a8c0@bananasenior>,
  195.     "Jonathan Osuch" <osuchj@uswest.net>  writes:
  196.  
  197. > We can certainly address this.  Since Allegro does this for us behind the
  198. > scenes, your input will be invaluable in setting this up.  I take it you are
  199. > suggesting something along the lines of: video=1024x768x5x6x5x0
  200. > Or, would it be cleaner to use a different command line, such as:
  201. > video=1024x768 depth=5:6:5:0
  202.  
  203. I hadn't thought much about this recently.  On 29-Apr-1999, I wrote
  204. the following (which can be had from the archives at
  205. <ftp://ftp.xmission.com/pub/lists/fractdev/archive/>:
  206.  
  207. =====
  208.     Date: Thu, 29 Apr 1999 19:55:01 -0600
  209.       To: fractdev@lists.xmission.com
  210.     From: Phil McRevis <legalize@xmission.xmission.com>
  211. Reply-To: legalize@xmission.com
  212.    Organ: multi-cellular, biological
  213.  Subject: driver characteristics
  214. - ---------
  215. Since Humberto brought up some specifics of drivers, I'll say a little
  216. about how I'm implementing the driver harness.  Naturally we'll be
  217. able to change the harness later.  The point is not to design some
  218. end-all be-all graphics API.  The idea is just to get things going
  219. incrementally.  Feel free to kibitz, if its a big issue, something can
  220. be done now, but please consider this more of a 'status report' for
  221. your information on what I'm doing, more than a design review where
  222. I'm proposing the idea. :-)
  223.  
  224. Existing video mode glue logic in fractint is currently implemented in
  225. select_video_mode().  It walks through the table stored in memory and
  226. creates the scrollable display of available video modes.  When you
  227. select a mode from the list (or by some other means like video=), then
  228. the proper parameters are snatched out of the table and sent to the
  229. assembly routine setvideomode (video.asm), which issues the
  230. appropriate commands to the video card.
  231.  
  232. With the harness, select_video_mode() instead walks a list of drivers
  233. and queries each driver about the modes supported by the driver.  It
  234. then displays a scrolling list created from the driver responses.
  235. When the user selects an item on the list, select_video_mode() calls
  236. through the driver harness to set the video mode.
  237.  
  238. This means that when we get to the point of having all (or several) or
  239. the drivers I list below, under win98 you could have the choice of
  240. the same video modes supported by multiple drivers.  The video display
  241. list might look like this:
  242.  
  243. key...driver...name.................xdot.ydot.color.comment.............
  244. SF1   win32    GDI Surface          1024x768  5:6:5
  245. SF2   directx  Windowed             1024x768  5:6:5
  246. SF3   directx  Full Screen          1024x768  8     256 colors
  247. SF4   directx  Full Screen          1024x768  5:6:5 16-bit RGB
  248. SF5   directx  Full Screen          1024x768  5:5:5 15-bit RGB
  249. SF6   opengl   Full Screen          1024x768  8     256 color indexed
  250. SF7   opengl   Full Screen          1024x768  8:8:8 24-bit RGB
  251.  
  252. (This is an ASCII graphic mockup; not a screen dump.)
  253.  
  254. Xdot and ydot take on a subtle meaning in a windowed environment, but
  255. window systemless drivers still need to be able to report device
  256. dimensions.
  257.  
  258. The video parameter ('video=<key>') currently only specifies a function
  259. key which is bound to a video mode.  It doesn't force a particular
  260. video mode, just selects one from the key list.  If you want to write a
  261. script or parameter file that uses a particular video mode, you have to
  262. ensure the proper key assignment is setup first.  To set the function
  263. key assignment you have to get into the fractint.cfg file.  Icky!
  264.  
  265. With the harness, the video parameter is updated to specify both the
  266. driver and the desires video mode provided by the driver.  So you'd
  267. say something like "video=directx/1024x768/8".  A new method for
  268. binding the keys to video modes will have to be provided, as the old
  269. method depended on fractint.cfg which is now specific to the fractint
  270. driver.
  271.  
  272. But what about the stuff the fractint.cfg file did?  That's used by the
  273. "fractint" driver (see blow) as input to decide what video modes it
  274. lists when queried.
  275.  
  276. Some really random ideas:
  277.  
  278. should image and model formats (3D raytracing files, etc) be
  279.     supported as compile-time modules like drivers?
  280.  
  281. should drivers be allowed to invoke the engine distinct from
  282.     fractint's gui?  Is the engine a client of the driver, or is the
  283.     driver a client of the engine?  Fractint is currently architected
  284.     towards the latter.  Reversing the assumption would be difficult.
  285.  
  286. should 3D drivers subsume 2D functionality?
  287.     Is there any reason you'd want to use ogl for 3D, but x11 for 2D?
  288.     If not, then "x11" and "opengl" drivers will provide everything
  289.     you need.  Select an "x11' driver video mode for 2D stuff and an
  290.     "opengl" driver video mode for 3D stuff.  Fractint doesn't (yet)
  291.     mix 2D and 3D rendering together.
  292.  
  293. Drivers
  294. - -------
  295. display drivers I think should be done, in no particular order:
  296.     "curses"
  297.     possibly uses curses, but only has character I/O.
  298.     Displays "pixels" using characters as similar to XaoS.
  299.     Enumerate text vide modes (DOS) or screen sizes (curses?) to
  300.         form "video modes" table.
  301.     Works in DOS (pd curses) and unix (native curses).
  302.  
  303.     "fractint"
  304.     port existing fractint assembly code to 32-bit flat model.
  305.     Included is the native video and mouse support coded in
  306.     assembly.
  307.  
  308.     "allegro"
  309.     Uses Allegro library under DJGPP to enumerate video formats
  310.     and provide video/mouse/sound support.
  311.  
  312.     "disk"
  313.     Video modes contain list of standard image sizes and "custom",
  314.     letting you set the size.
  315.  
  316.     "win32"
  317.     text menus are displayed graphically somehow.
  318.     graphics display native to GDI presented as video mode.
  319.     Emulate other modes?  Only if someone desperate for it --
  320.     directx would be the preferred solution!
  321.  
  322.     "directx"
  323.     text menus are displayed using a regular win32 window on GDI
  324.         surface, or as graphic text on graphics screen (driver
  325.         option).
  326.     graphics display is done through full-screen with DirectDraw.
  327.     DirectDrawDevices enumerated by DDraw are the video modes.
  328.  
  329.     "direct3d"
  330.     Same as directx, but uses D3D for 3D effects.
  331.  
  332.     "x11"
  333.     Text menus are displayed graphically using X11.
  334.     Available visuals on the screen are the video modes.
  335.     
  336.     "opengl"
  337.     Same as X11, only OGL-capable visuals are video modes.
  338.     Uses OGL for all pixel I/O and 3D.
  339.  
  340. like XaoS, more that one driver can be available, but only one driver
  341. can be active at once in any given graphic window.
  342. =====
  343.  
  344. So I think I was expecting that the old video mode specifications
  345. would still be supported (they wouldn't contain /'s) and that the new
  346. video specification would be a driver/resolution/depth argument, where
  347. the depth would be stated to be sufficiently unique.  I think I prefer
  348. R:G:B:A, with the letters replaced by the number of bits dedicated to
  349. each color channel.  This disambiguates 5:5:5, 5:6:5, and 5:5:5:1
  350. pixel formats for 16-bit depth, i.e. "video=allegro/1024x768/5:5:5".
  351.  
  352. > Yes, I agree.  But, in order to not break PAR's that use video=, we will
  353. > still need to map those function keys to video modes.  OTOH, we could just
  354. > ignore video= commands in PARs.  The problem that raises is that there are
  355. > some images that are resolution dependent.
  356.  
  357. For the "video=SF5" case, we handle the existing mapping of function
  358. keys to video modes but only via the default key mapping.  I never
  359. liked the idea that someone else could customize their key mapping and
  360. I'd get a different resolution image because I didn't have their map
  361. of keys to video modes.  So just support the default key mapping for
  362. backwards compatability and don't read the mapping file (or ignore the
  363. mapping section of the fractint.cfg or wherever its stored, I forget).
  364. This will give people who customized the mapping file an incentive to
  365. use the new video format specification that isn't dependent on their
  366. key mappings.
  367.  
  368. > Currently that is crudely done by recompiling.  I haven't taken a close look
  369. > at how to switch from one device to another when both are memory resident.
  370.  
  371. I imagined that the total number of drivers available is decided at
  372. compile time.  Since I started by working on the X11 driver, I didn't
  373. get to the point where switching between drivers was something that I
  374. tried.  However, I think the driver structure that I put together can
  375. handle this.  In the code I wrote, you can see where I do a 'trick' of
  376. having the first N bytes of the driver structures identical across all
  377. drivers and drivers tack on their own private data at the end of this
  378. structure.  This lets all code outside the driver treat the all
  379. drivers the same, but inside each driver, a cast is used to make the
  380. driver private data visible inside the driver-related code.
  381.  
  382. For X11 this is where things like the Display * pointer, and so-on get
  383. stored.  I imagine that Allegro also has a few little bits of
  384. configuration data that the driver needs -- opaque handles to
  385. resources or whatnot.  The Allegro driver should follow a similar
  386. pattern to the X11 code in how it stores this data.
  387.  
  388. To switch from one driver to another dynamically, you ask the existing
  389. driver to shut itself down and clean up its private data.  (A
  390. full-screen DirectX driver here would release the exclusive access to
  391. the full-screen here, for instance.)  Then you ask the new driver to
  392. initialize itself and allocate its private data.  The you set the
  393. "current driver pointer" to point to the new driver's data block.
  394.  
  395. A driver can implement its driver+private data structure as a
  396. statically allocated file-scope struct, provided it is careful about
  397. how it uses the data block.  A driver could also implement things by
  398. dynamically allocating the structure.  Everyone outside the driver
  399. doesn't care because everything happens through a pointer no matter
  400. how the block of data was allocated.
  401.  
  402.  
  403. > It appears to me that the windows allowed by Allegro can also be arbitrarily
  404. > sized.  Although you can run into a problem with the text being too small or
  405. > off the edge of the window.
  406.  
  407. This could be useful.  I was wondering how to draw legible text in a
  408. tiny video mode like 320x200.  Fractint deals with it by having a
  409. hand-coded "font" bitmap that it copies into video memory, but when
  410. you move to a framework, you have to wonder how the framework will
  411. deal with these kinds of things.  Frankly I'm not too worried about
  412. 320x200 looking crappy :-)
  413.  
  414. > P.S.  If I don't respond to something you think is important it's probably
  415. > because it went zinging over my head.  Please feel free to reiterate.
  416.  
  417. OK, well its probably best for you to ask me to repeat things you
  418. don't understand, if any.  Otherwise if you don't comment on it I'll
  419. assume you understood it all :-).  I don't mind re-explaining
  420. something different or in more detail so don't be shy about asking.
  421. - --
  422. <http://www.xmission.com/~legalize/>    Legalize Adulthood!
  423.     ``Ain't it funny that they all fire the pistol,     
  424.       at the wrong end of the race?''--PDBT     
  425. legalize@xmission.com    <http://www.xmission.com/~legalize/who/>
  426.  
  427. - --------------------------------------------------------------
  428. Thanks for using Fractdev, The Fractint Developer's Discussion List
  429. Post Message:   fractdev@lists.xmission.com
  430. Get Commands:   majordomo@lists.xmission.com "help"
  431. Administrator:  twegner@fractint.org
  432. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  433.  
  434. ------------------------------
  435.  
  436. Date: Thu, 29 Jun 2000 17:54:22 -0600
  437. From: Phil McRevis <legalize@xmission.com>
  438. Subject: Re: Allegro port status 
  439.  
  440. In article <000901bfe210$aaca4500$0100a8c0@bananasenior>,
  441.     "Jonathan Osuch" <osuchj@uswest.net>  writes:
  442.  
  443. > We can certainly address this.  Since Allegro does this for us behind the
  444. > scenes, your input will be invaluable in setting this up.  I take it you are
  445. > suggesting something along the lines of: video=1024x768x5x6x5x0
  446. > Or, would it be cleaner to use a different command line, such as:
  447. > video=1024x768 depth=5:6:5:0
  448.  
  449. I hadn't thought much about this recently.  On 29-Apr-1999, I wrote
  450. the following (which can be had from the archives at
  451. <ftp://ftp.xmission.com/pub/lists/fractdev/archive/>:
  452.  
  453. =====
  454.     Date: Thu, 29 Apr 1999 19:55:01 -0600
  455.       To: fractdev@lists.xmission.com
  456.     From: Phil McRevis <legalize@xmission.xmission.com>
  457. Reply-To: legalize@xmission.com
  458.    Organ: multi-cellular, biological
  459.  Subject: driver characteristics
  460. - ---------
  461. Since Humberto brought up some specifics of drivers, I'll say a little
  462. about how I'm implementing the driver harness.  Naturally we'll be
  463. able to change the harness later.  The point is not to design some
  464. end-all be-all graphics API.  The idea is just to get things going
  465. incrementally.  Feel free to kibitz, if its a big issue, something can
  466. be done now, but please consider this more of a 'status report' for
  467. your information on what I'm doing, more than a design review where
  468. I'm proposing the idea. :-)
  469.  
  470. Existing video mode glue logic in fractint is currently implemented in
  471. select_video_mode().  It walks through the table stored in memory and
  472. creates the scrollable display of available video modes.  When you
  473. select a mode from the list (or by some other means like video=), then
  474. the proper parameters are snatched out of the table and sent to the
  475. assembly routine setvideomode (video.asm), which issues the
  476. appropriate commands to the video card.
  477.  
  478. With the harness, select_video_mode() instead walks a list of drivers
  479. and queries each driver about the modes supported by the driver.  It
  480. then displays a scrolling list created from the driver responses.
  481. When the user selects an item on the list, select_video_mode() calls
  482. through the driver harness to set the video mode.
  483.  
  484. This means that when we get to the point of having all (or several) or
  485. the drivers I list below, under win98 you could have the choice of
  486. the same video modes supported by multiple drivers.  The video display
  487. list might look like this:
  488.  
  489. key...driver...name.................xdot.ydot.color.comment.............
  490. SF1   win32    GDI Surface          1024x768  5:6:5
  491. SF2   directx  Windowed             1024x768  5:6:5
  492. SF3   directx  Full Screen          1024x768  8     256 colors
  493. SF4   directx  Full Screen          1024x768  5:6:5 16-bit RGB
  494. SF5   directx  Full Screen          1024x768  5:5:5 15-bit RGB
  495. SF6   opengl   Full Screen          1024x768  8     256 color indexed
  496. SF7   opengl   Full Screen          1024x768  8:8:8 24-bit RGB
  497.  
  498. (This is an ASCII graphic mockup; not a screen dump.)
  499.  
  500. Xdot and ydot take on a subtle meaning in a windowed environment, but
  501. window systemless drivers still need to be able to report device
  502. dimensions.
  503.  
  504. The video parameter ('video=<key>') currently only specifies a function
  505. key which is bound to a video mode.  It doesn't force a particular
  506. video mode, just selects one from the key list.  If you want to write a
  507. script or parameter file that uses a particular video mode, you have to
  508. ensure the proper key assignment is setup first.  To set the function
  509. key assignment you have to get into the fractint.cfg file.  Icky!
  510.  
  511. With the harness, the video parameter is updated to specify both the
  512. driver and the desires video mode provided by the driver.  So you'd
  513. say something like "video=directx/1024x768/8".  A new method for
  514. binding the keys to video modes will have to be provided, as the old
  515. method depended on fractint.cfg which is now specific to the fractint
  516. driver.
  517.  
  518. But what about the stuff the fractint.cfg file did?  That's used by the
  519. "fractint" driver (see blow) as input to decide what video modes it
  520. lists when queried.
  521.  
  522. Some really random ideas:
  523.  
  524. should image and model formats (3D raytracing files, etc) be
  525.     supported as compile-time modules like drivers?
  526.  
  527. should drivers be allowed to invoke the engine distinct from
  528.     fractint's gui?  Is the engine a client of the driver, or is the
  529.     driver a client of the engine?  Fractint is currently architected
  530.     towards the latter.  Reversing the assumption would be difficult.
  531.  
  532. should 3D drivers subsume 2D functionality?
  533.     Is there any reason you'd want to use ogl for 3D, but x11 for 2D?
  534.     If not, then "x11" and "opengl" drivers will provide everything
  535.     you need.  Select an "x11' driver video mode for 2D stuff and an
  536.     "opengl" driver video mode for 3D stuff.  Fractint doesn't (yet)
  537.     mix 2D and 3D rendering together.
  538.  
  539. Drivers
  540. - -------
  541. display drivers I think should be done, in no particular order:
  542.     "curses"
  543.     possibly uses curses, but only has character I/O.
  544.     Displays "pixels" using characters as similar to XaoS.
  545.     Enumerate text vide modes (DOS) or screen sizes (curses?) to
  546.         form "video modes" table.
  547.     Works in DOS (pd curses) and unix (native curses).
  548.  
  549.     "fractint"
  550.     port existing fractint assembly code to 32-bit flat model.
  551.     Included is the native video and mouse support coded in
  552.     assembly.
  553.  
  554.     "allegro"
  555.     Uses Allegro library under DJGPP to enumerate video formats
  556.     and provide video/mouse/sound support.
  557.  
  558.     "disk"
  559.     Video modes contain list of standard image sizes and "custom",
  560.     letting you set the size.
  561.  
  562.     "win32"
  563.     text menus are displayed graphically somehow.
  564.     graphics display native to GDI presented as video mode.
  565.     Emulate other modes?  Only if someone desperate for it --
  566.     directx would be the preferred solution!
  567.  
  568.     "directx"
  569.     text menus are displayed using a regular win32 window on GDI
  570.         surface, or as graphic text on graphics screen (driver
  571.         option).
  572.     graphics display is done through full-screen with DirectDraw.
  573.     DirectDrawDevices enumerated by DDraw are the video modes.
  574.  
  575.     "direct3d"
  576.     Same as directx, but uses D3D for 3D effects.
  577.  
  578.     "x11"
  579.     Text menus are displayed graphically using X11.
  580.     Available visuals on the screen are the video modes.
  581.     
  582.     "opengl"
  583.     Same as X11, only OGL-capable visuals are video modes.
  584.     Uses OGL for all pixel I/O and 3D.
  585.  
  586. like XaoS, more that one driver can be available, but only one driver
  587. can be active at once in any given graphic window.
  588. =====
  589.  
  590. So I think I was expecting that the old video mode specifications
  591. would still be supported (they wouldn't contain /'s) and that the new
  592. video specification would be a driver/resolution/depth argument, where
  593. the depth would be stated to be sufficiently unique.  I think I prefer
  594. R:G:B:A, with the letters replaced by the number of bits dedicated to
  595. each color channel.  This disambiguates 5:5:5, 5:6:5, and 5:5:5:1
  596. pixel formats for 16-bit depth, i.e. "video=allegro/1024x768/5:5:5".
  597.  
  598. > Yes, I agree.  But, in order to not break PAR's that use video=, we will
  599. > still need to map those function keys to video modes.  OTOH, we could just
  600. > ignore video= commands in PARs.  The problem that raises is that there are
  601. > some images that are resolution dependent.
  602.  
  603. For the "video=SF5" case, we handle the existing mapping of function
  604. keys to video modes but only via the default key mapping.  I never
  605. liked the idea that someone else could customize their key mapping and
  606. I'd get a different resolution image because I didn't have their map
  607. of keys to video modes.  So just support the default key mapping for
  608. backwards compatability and don't read the mapping file (or ignore the
  609. mapping section of the fractint.cfg or wherever its stored, I forget).
  610. This will give people who customized the mapping file an incentive to
  611. use the new video format specification that isn't dependent on their
  612. key mappings.
  613.  
  614. > Currently that is crudely done by recompiling.  I haven't taken a close look
  615. > at how to switch from one device to another when both are memory resident.
  616.  
  617. I imagined that the total number of drivers available is decided at
  618. compile time.  Since I started by working on the X11 driver, I didn't
  619. get to the point where switching between drivers was something that I
  620. tried.  However, I think the driver structure that I put together can
  621. handle this.  In the code I wrote, you can see where I do a 'trick' of
  622. having the first N bytes of the driver structures identical across all
  623. drivers and drivers tack on their own private data at the end of this
  624. structure.  This lets all code outside the driver treat the all
  625. drivers the same, but inside each driver, a cast is used to make the
  626. driver private data visible inside the driver-related code.
  627.  
  628. For X11 this is where things like the Display * pointer, and so-on get
  629. stored.  I imagine that Allegro also has a few little bits of
  630. configuration data that the driver needs -- opaque handles to
  631. resources or whatnot.  The Allegro driver should follow a similar
  632. pattern to the X11 code in how it stores this data.
  633.  
  634. To switch from one driver to another dynamically, you ask the existing
  635. driver to shut itself down and clean up its private data.  (A
  636. full-screen DirectX driver here would release the exclusive access to
  637. the full-screen here, for instance.)  Then you ask the new driver to
  638. initialize itself and allocate its private data.  The you set the
  639. "current driver pointer" to point to the new driver's data block.
  640.  
  641. A driver can implement its driver+private data structure as a
  642. statically allocated file-scope struct, provided it is careful about
  643. how it uses the data block.  A driver could also implement things by
  644. dynamically allocating the structure.  Everyone outside the driver
  645. doesn't care because everything happens through a pointer no matter
  646. how the block of data was allocated.
  647.  
  648.  
  649. > It appears to me that the windows allowed by Allegro can also be arbitrarily
  650. > sized.  Although you can run into a problem with the text being too small or
  651. > off the edge of the window.
  652.  
  653. This could be useful.  I was wondering how to draw legible text in a
  654. tiny video mode like 320x200.  Fractint deals with it by having a
  655. hand-coded "font" bitmap that it copies into video memory, but when
  656. you move to a framework, you have to wonder how the framework will
  657. deal with these kinds of things.  Frankly I'm not too worried about
  658. 320x200 looking crappy :-)
  659.  
  660. > P.S.  If I don't respond to something you think is important it's probably
  661. > because it went zinging over my head.  Please feel free to reiterate.
  662.  
  663. OK, well its probably best for you to ask me to repeat things you
  664. don't understand, if any.  Otherwise if you don't comment on it I'll
  665. assume you understood it all :-).  I don't mind re-explaining
  666. something different or in more detail so don't be shy about asking.
  667. - --
  668. <http://www.xmission.com/~legalize/>    Legalize Adulthood!
  669.     ``Ain't it funny that they all fire the pistol,     
  670.       at the wrong end of the race?''--PDBT     
  671. legalize@xmission.com    <http://www.xmission.com/~legalize/who/>
  672.  
  673. - --------------------------------------------------------------
  674. Thanks for using Fractdev, The Fractint Developer's Discussion List
  675. Post Message:   fractdev@lists.xmission.com
  676. Get Commands:   majordomo@lists.xmission.com "help"
  677. Administrator:  twegner@fractint.org
  678. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  679.  
  680. ------------------------------
  681.  
  682. Date: Thu, 29 Jun 2000 20:37:31 -0500
  683. From: "Jonathan Osuch" <osuchj@uswest.net>
  684. Subject: Re: Allegro port status 
  685.  
  686. Rich,
  687.  
  688. > The Allegro driver should follow a similar
  689. > pattern to the X11 code in how it stores this data.
  690.  
  691. Yes, it does.  I started by copying your X11 file and then changed things
  692. over to Allegro specific.  I still need to clean up the extra variables.  I
  693. believe, in my version, the disk video and X11 drivers are broken.  I'll fix
  694. them.
  695.  
  696. Now I see how we will switch between drivers.  However, what do we do on
  697. initial startup, ie. no video= statement in sstools.ini?  The program flow
  698. has been slightly altered in Xfractint because a video mode has to be
  699. selected (window opened) before text can be displayed.  We need to use a
  700. default driver to display the initial selection of drivers.  The disk video
  701. mode would be appropriate, but is it going to change from Allegro to W32,
  702. etc.?  Are we going to end up with multiple disk video drivers?
  703.  
  704. > OK, well its probably best for you to ask me to repeat things you
  705. > don't understand, if any.  Otherwise if you don't comment on it I'll
  706. > assume you understood it all :-).  I don't mind re-explaining
  707. > something different or in more detail so don't be shy about asking.
  708.  
  709. Okay, here goes.  Your description of how to implement an event-driven
  710. architecture has baffled me.  Not the basics, but how to use it in Fractint.
  711. What I would like to do, but don't know how, is to start up the event
  712. handler and then start the fractal engine and the plotting engine as
  713. children.  The data would be sent from the fractal engine to the plotting
  714. engine to be plotted on the screen.
  715.  
  716. Another thing that I'd like to know is the proper way to give time slices
  717. back to the operating system when the calculation is done.  This isn't from
  718. any of your comments, just something I'd like to know.
  719.  
  720. Jonathan
  721.  
  722.  
  723.  
  724. - --------------------------------------------------------------
  725. Thanks for using Fractdev, The Fractint Developer's Discussion List
  726. Post Message:   fractdev@lists.xmission.com
  727. Get Commands:   majordomo@lists.xmission.com "help"
  728. Administrator:  twegner@fractint.org
  729. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  730.  
  731. ------------------------------
  732.  
  733. Date: Fri, 30 Jun 2000 20:12:37 -0600
  734. From: Phil McRevis <legalize@xmission.com>
  735. Subject: Re: Allegro port status 
  736.  
  737. Did anyone else get two copies of my last message?  Sorry if I sent
  738. two by mistake, I seem to have received two.
  739.  
  740. In article <001b01bfe237$86805820$0100a8c0@bananasenior>,
  741.     "Jonathan Osuch" <osuchj@uswest.net>  writes:
  742.  
  743. > Now I see how we will switch between drivers.  However, what do we do on
  744. > initial startup, ie. no video= statement in sstools.ini?
  745.  
  746. My thoughts on this were: it depends on the platform.  Each "platform
  747. port" of fractint should select a lowest-common denominator video mode
  748. that is the most likely to be present or even better guaranteed to
  749. be present.  For X11 this means the default visual on the default
  750. display; for Win32 it means a Win32 GDI window on the desktop; I am
  751. not sure what Allegro would use for its default, but I'm betting that
  752. you do.
  753.  
  754. > [...] the initial selection of drivers.  The disk video
  755. > mode would be appropriate,
  756.  
  757. I was thinking that disk video mode would only be appropriate for the
  758. DOS code.  Here, "DOS" would be a platform distinct from Win32.  So
  759. the author of the "DOS" port would make the default driver the disk
  760. video mode driver.
  761.  
  762. > [The disk video mode] but is it going to change from Allegro to W32,
  763. > etc.?  Are we going to end up with multiple disk video drivers?
  764.  
  765. I think disk video mode should be platform and driver agnostic.  Disk
  766. video should be a portable software interface to a memory buffer as the
  767. video "device" and not depend on Win32 or any other driver or platform
  768. specific code.  The existing disk video mode code can be drawn into
  769. that driver.  (I think I did that for d_disk.c in the re-org of the
  770. code I put up).
  771.  
  772. That brings up the question of what a disk video mode uses for text I/O
  773. of menus and the like.  If you restrict yourself to the text I/O
  774. currently in fractint with its menu routines then everything will boil
  775. down to the few driver calls relating to text I/O.  From there the
  776. driver can take the text and display it using whatever method is
  777. appropriate for the platform.
  778.  
  779. I was thinking perhaps the most portable thing to do is to use curses.
  780. Curses libraries for MS-DOS exist and should be pretty well debugged at
  781. this point.  Curses is well supported for unix as well.  Is it on the
  782. mac?  Frankly, I can't see the point of making a curses-based disk
  783. video driver for the Mac; just use the Mac toolbox.  On the other
  784. hand, nothing fancier than a DMI DOS application that just used
  785. character I/O for status reporting could run on just about any old
  786. computer DOS-wise as a "dumb render farm".  It wouldn't even need
  787. VGA.
  788.  
  789. > Okay, here goes.  Your description of how to implement an event-driven
  790. > architecture has baffled me.  Not the basics, but how to use it in Fractint.
  791.  
  792. OK, I'm looking at ant.c right now.  I'll restructure ant.c according
  793. to the schema I advocated in an earlier message, that should make
  794. things concrete.  I'll post it in a separate message.
  795.  
  796. > What I would like to do, but don't know how, is to start up the event
  797. > handler and then start the fractal engine and the plotting engine as
  798. > children.
  799.  
  800. I see two choices here: threads or idle processing.
  801.  
  802. With threads, you can start a separate thread of control executing
  803. through the code which can simplify the implementation and readability
  804. of the code.  On Win32 and *nix both have threads, and so does the Mac
  805. I believe.  For threads, that leaves DOS as an unknown; I believe I've
  806. seen "thread" implementation libraries for DOS, but I've never
  807. investigated them in any great detail.  Perhaps someone else knows
  808. about thread support for DOS.  A Win32 console program can use threads,
  809. but that's not the same as a PMI DOS executable.
  810.  
  811. With idle processing, the program maintains a flag that it is doing
  812. background processing while also receiving input from the system.  In
  813. fractint currently, each local routine looking for input while doing
  814. processing has its own copy of the logic to look for input interspersed
  815. with doing bits of computation.  Each routine "polls" or checks the
  816. state of the input buffer for mouse and keyboard events while in the
  817. middle of a long processing loop.  (I think the mouse event code got
  818. hidden inside the keyboard checking code!)
  819.  
  820. Idle processing keeps everything going by checking for input while
  821. processing is occuring.  The processing continues so long as there is
  822. no input available.  When input does become available, the idle
  823. processing loop either stops (like when you press ESC) or switches to
  824. an input processing loop like that contained in the text menu code.
  825. Depending on the area of fractint, the idle processing may continue
  826. after the text menu returns control back to its caller.
  827.  
  828. > The data would be sent from the fractal engine to the plotting
  829. > engine to be plotted on the screen.
  830.  
  831. Or rather a pointer to the data, or an agreed upon global buffer.  No
  832. need to copy around lots of data :-).
  833.  
  834. > Another thing that I'd like to know is the proper way to give time slices
  835. > back to the operating system when the calculation is done.
  836.  
  837. With threads, the one or more computation threads go into a wait state,
  838. waiting to be woken up and signalled that there is more work to do
  839. (points to plot with the fractal function, pixels to draw).
  840.  
  841. With idle processing you simply toggle the flag that indicates work to
  842. be done during idle states when the program would otherwise be blocked
  843. waiting for a key press or mouse event.  Since there is no background
  844. work to be done, the idle processing variation can just issue the
  845. blocking I/O call since fractint's data processing is always driven by
  846. input, whether from the keyboard or a file.
  847.  
  848. - --
  849. <http://www.xmission.com/~legalize/>    Legalize Adulthood!
  850.     ``Ain't it funny that they all fire the pistol,     
  851.       at the wrong end of the race?''--PDBT     
  852. legalize@xmission.com    <http://www.xmission.com/~legalize/who/>
  853.  
  854. - --------------------------------------------------------------
  855. Thanks for using Fractdev, The Fractint Developer's Discussion List
  856. Post Message:   fractdev@lists.xmission.com
  857. Get Commands:   majordomo@lists.xmission.com "help"
  858. Administrator:  twegner@fractint.org
  859. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  860.  
  861. ------------------------------
  862.  
  863. Date: Fri, 30 Jun 2000 21:12:07 -0600
  864. From: Phil McRevis <legalize@xmission.com>
  865. Subject: ant.c example
  866.  
  867. Existing ant.c routine TurkMite1 which does ant simulation processing
  868. until ESC is pressed or the number of desired points are plotted.
  869. TurkMite1 is called by ant(), which is called by the main input
  870. processing loop in framain2.c. (look for case 1: /* ^a Ant */)
  871.  
  872. =====================================================================
  873.  
  874. void
  875. TurkMite1(int maxtur, int rule_len, char *ru, long maxpts, long wait)
  876. {
  877.    int color, ix, iy, idir, pixel, i;
  878.    int kbdchar, step, antwrap;
  879.    int x[MAX_ANTS + 1], y[MAX_ANTS + 1];
  880.    int next_col[MAX_ANTS + 1], rule[MAX_ANTS + 1], dir[MAX_ANTS + 1];
  881.    long count;
  882.  
  883.    /*-=-=-=-=- long block of setup code elided -=-=-=-=-*/
  884.  
  885.    maxpts = maxpts / (long) INNER_LOOP;
  886.    for (count = 0; count < maxpts; count++)
  887.    {
  888.       /* check for a key only every inner_loop times */
  889.       kbdchar = keypressed();
  890.       if (kbdchar || step)
  891.       {
  892.          int done = 0;
  893.          if (kbdchar == 0)
  894.             kbdchar = getakey();
  895.          switch (kbdchar)
  896.          {
  897.          case SPACE:
  898.             step = 1 - step;
  899.             break;
  900.          case ESC:
  901.             done = 1;
  902.             break;
  903.          case RIGHT_ARROW:    case UP_ARROW:
  904.      case DOWN_ARROW:    case LEFT_ARROW:
  905.      case RIGHT_ARROW_2:    case UP_ARROW_2:
  906.          case DOWN_ARROW_2:    case LEFT_ARROW_2:
  907.        setwait(&wait);
  908.             break;
  909.          default:
  910.             done = 1;
  911.             break;
  912.          }
  913.          if (done)
  914.             goto exit_ant;
  915.          if (keypressed())
  916.             getakey();
  917.       }
  918.       for (i = INNER_LOOP; i; i--)
  919.       {
  920.     /* -=-=- inner loop of ant processing omitted; no I/O here -=-=- */
  921.       }
  922.    }
  923. exit_ant:
  924.    return;
  925. }
  926.  
  927. =====================================================================
  928.  
  929.  
  930. so what we have here in pseudocode is:
  931.  
  932. big_while_loop():
  933. initializes big while loop state
  934. loops forever
  935.     get input and call main_menu_switch()
  936.  
  937.     main_menu_switch():
  938.     parses input and calls ant()
  939.  
  940.         ant():
  941.         ant() calls TurkMite1()
  942.  
  943.         TurkMite1():
  944.         initialize local ant state
  945.         for each point to be plotted
  946.             if key pressed
  947.             if ESC pressed
  948.                 return
  949.             else
  950.                 process input locally
  951.             endif
  952.             endif
  953.             do increment of work using ant state
  954.         endfor
  955. done
  956. cleanup
  957.  
  958. So what we have inside this "calculation" is some exit logic (if ESC
  959. pressed), some input processing logic, and some incrmental work to be
  960. done.
  961.  
  962. Every routine that handles keyboard input in fractint is like this,
  963. except that some of them don't have incremental background processing
  964. they could do while waiting for input, so they just block waiting for
  965. input.  The text menu routines are an example of that kind of input
  966. processing.
  967.  
  968. Most "background processing" routines continue working until a key is
  969. pressed and then they return control to a menu or their caller (such
  970. as what TurkMite1 does when you are running the ant simulation and
  971. press ESC, returning control to the main fractal routine which
  972. processes the ESC as a signal to throw up the main menu).
  973.  
  974. Under an event processing organization, you would localize all the
  975. event processing to the main routine.  In Win32 this is the main
  976. message pump loop implemented with the usual GetMessage() and
  977. DispatchMessage().  In X11 its the event loop implemented around
  978. XNextEvent() and XtNextEvent().  The Mac has its own event loop
  979. processing routines as well.  In pseudocode, it looks more like this:
  980.  
  981. "idle processing style"
  982. big_while_loop():
  983. initializes
  984. quit = false
  985. while (!quit)
  986.     if (event)
  987.     get event
  988.     if (quit event)
  989.         quit = true
  990.     else
  991.         dispatch event to input sink:
  992.         if (keymap[input key])
  993.             call handler through (*keymap[input key])()
  994.  
  995.             handler for ^A on main menu (evolution of
  996.             main_menu_switch):
  997.             set idle routine to ant idle routine
  998.             set idle state data to new ant idle state
  999.  
  1000.         endif
  1001.     endif
  1002.     else if (idle routine)
  1003.     call idle routine with idle state data
  1004.     if (idle routine done processing)
  1005.         reset idle routine
  1006.         reset idle state data
  1007.     endif
  1008.     endif
  1009. done
  1010. cleanup
  1011.  
  1012. "threads style"
  1013.  
  1014. GUI thread:                    worker thread:
  1015.  
  1016. big_while_loop():                initialize
  1017. initializes                    while (!quit)
  1018. create worker thread                    obtain work item
  1019.                             do incremental work
  1020. quit = false                    done
  1021. while (!quit)                    cleanup
  1022.     if (event)
  1023.     get event
  1024.     if (quit event)
  1025.         quit = true
  1026.     else
  1027.         dispatch event to input sink
  1028.     endif
  1029.     endif
  1030. done
  1031. wait for worker threads
  1032. cleanup
  1033.  
  1034. The big difference between the two styles is that the single event
  1035. loop construction means you have to store intermediate data that is
  1036. communicated from one incremental work step to the next available
  1037. through a pointer or global variable.  So that means that the local
  1038. variables and local state initialized in TurkMite1() would have to be
  1039. stored in a piece of memory to be passed to each successive invocation
  1040. of the incremental work procedure that replaces TurkMite1 in the event
  1041. scheme.
  1042.  
  1043. By localizing the event mechanism to one place it becomes reasonable
  1044. to replace it with other event mechanisms such as event dispatching
  1045. under MFC, Win32 dialogs with their own message procs, Motif/Xt event
  1046. dispatching, and so-on.  This will allow fractint to eventually evolve
  1047. in the direction of a professional "Mac look and feel" interface
  1048. coexisting on the same code base as a professional "Win2000 look and
  1049. feel" interface.
  1050.  
  1051. This is my hope for fractint -- that it can evolve to having
  1052. professional looking interfaces native to the platform.  It may or may
  1053. not be possible.  Or it may be too much work and it may be easier to
  1054. evolve the current event processing in the keyboard code.  For now its
  1055. probably easier to just get the existing stuff working with the driver
  1056. interface rather than undertake so large a code change.  The driver
  1057. was a big enough change as it was and that already consumed my time
  1058. and passed on to someone else :-)
  1059. - --
  1060. <http://www.xmission.com/~legalize/>    Legalize Adulthood!
  1061.     ``Ain't it funny that they all fire the pistol, 
  1062.       at the wrong end of the race?''--PDBT
  1063.       <http://www.xmission.com/~legalize/who/>
  1064.  
  1065. - --------------------------------------------------------------
  1066. Thanks for using Fractdev, The Fractint Developer's Discussion List
  1067. Post Message:   fractdev@lists.xmission.com
  1068. Get Commands:   majordomo@lists.xmission.com "help"
  1069. Administrator:  twegner@fractint.org
  1070. Unsubscribe:    majordomo@lists.xmission.com "unsubscribe fractdev"
  1071.  
  1072. ------------------------------
  1073.  
  1074. End of fractdev-digest V1 #32
  1075. *****************************
  1076.  
  1077.