[pal-cvs] CVS pal

tneste tneste at common-lisp.net
Wed Oct 31 12:51:23 UTC 2007


Update of /project/pal/cvsroot/pal
In directory clnet:/tmp/cvs-serv6234

Modified Files:
	changes.txt color.lisp pal.asd pal.lisp readme.txt todo.txt 
Log Message:
Some polishing. Version 1.1

--- /project/pal/cvsroot/pal/changes.txt	2007/07/28 13:13:15	1.3
+++ /project/pal/cvsroot/pal/changes.txt	2007/10/31 12:51:22	1.4
@@ -1,3 +1,32 @@
+1.1, October 31 2007
+
+- Fixed handling of texture sizes. Changed the location of application data folder on windows.
+
+- Fixed handling of coordinates in WITH-CLIPPING.
+
+- MESSAGE now accepts multiple arguments.
+
+- KEYSYM-CHAR now returns NIL for characters out the range 1 - 255.
+
+- Added fading arguments to play-music/halt-music.
+
+- RESET-BLEND-MODE renamed to RESET-BLEND.
+
+- Smoothp option now mostly works with filled polygons.
+
+- Minor cleanups and name changes: circles-overlap => circles-overlap-p,
+  point-inside-rectangle => point-inside-rectangle-p, point-in-line => point-in-line-p.
+
+- Optimised GL state handling. Image drawing is a lot faster under certain
+  conditions.
+
+- Added color.lisp, WITH-BLEND now uses COLOR struct instead of a list of rgba
+  values.
+
+- Removed CURRY.
+
+
+
 1.0, July 28 2007
 
 - Numerous bugfixes and little improvements.
@@ -16,7 +45,8 @@
 
 - RELT renamed to RANDOM-ELEMENT.
 
-- Added DRAW-ARROW, DRAW-CIRCLE, LOAD-IMAGE-TO-ARRAY, SCREEN-TO-ARRAY, IMAGE-FROM-FN.
+- Added DRAW-ARROW, DRAW-CIRCLE, LOAD-IMAGE-TO-ARRAY, SCREEN-TO-ARRAY,
+  IMAGE-FROM-FN.
 
 - Tag thunks must now return only objects of type RESOURCE.
 
--- /project/pal/cvsroot/pal/color.lisp	2007/10/30 20:43:10	1.1
+++ /project/pal/cvsroot/pal/color.lisp	2007/10/31 12:51:22	1.2
@@ -1,15 +1,19 @@
 (in-package :pal)
 
+(declaim (optimize (speed 3)
+                   (safety 1)))
+
 
 (defstruct color
-  (r 0 :type pal::u8)
-  (g 0 :type pal::u8)
-  (b 0 :type pal::u8)
-  (a 0 :type pal::u8))
+  (r 0 :type u8)
+  (g 0 :type u8)
+  (b 0 :type u8)
+  (a 0 :type u8))
 
 
 (declaim (inline color))
-(defun color (r g b a)
+(defun color (r g b &optional (a 255))
+  (declare (type u8 r) (type u8 g) (type u8 b) (type u8 a))
   (make-color :r r :g g :b b :a a))
 
 
--- /project/pal/cvsroot/pal/pal.asd	2007/10/30 20:43:10	1.4
+++ /project/pal/cvsroot/pal/pal.asd	2007/10/31 12:51:22	1.5
@@ -9,7 +9,7 @@
   ((:file "ffi"
           :depends-on ("package"))
    (:file "color"
-          :depends-on ("package"))
+          :depends-on ("package" "ffi"))
    (:file "vector"
           :depends-on ("pal-macros"))
    (:file "pal-macros"
--- /project/pal/cvsroot/pal/pal.lisp	2007/10/30 20:43:10	1.38
+++ /project/pal/cvsroot/pal/pal.lisp	2007/10/31 12:51:22	1.39
@@ -180,7 +180,7 @@
 
 (defunct keysym-char (keysym)
     (symbol keysym)
-  (if (or (eq keysym :key-mouse-1) (eq keysym :key-mouse-2) (eq keysym :key-mouse-3))
+  (if (or (eq keysym :key-mouse-1) (eq keysym :key-mouse-2) (eq keysym :key-mouse-3) (eq keysym :key-mouse-4) (eq keysym :key-mouse-5))
       nil
       (let ((kv (cffi:foreign-enum-value 'pal-ffi:sdl-key keysym)))
         (if (and (> kv 0) (< kv 256))
--- /project/pal/cvsroot/pal/readme.txt	2007/07/19 16:37:25	1.1
+++ /project/pal/cvsroot/pal/readme.txt	2007/10/31 12:51:23	1.2
@@ -1,11 +1,13 @@
 
 Linux gfx card problems
+--------------------------------------------------------------------------------
 
+(Edit: Update to Ubuntu 7.10 seems to have fixed my problems with X550.)
 
 It seems that some people (yours truly included, running Ubuntu 7.04 with ATI
 X550 and the OSS drivers) are having problems under Linux when trying to run
 PAL applications several times in the same Lisp session. I did some testing and
-it _looks_ like the problem is in some graphics cards drivers. Of course it is
+it seems to be a problem in some graphics cards drivers. Of course it is
 possible that there is a bug in PAL, but so far I haven't find it.
 
 Running the following function twice after PAL is loaded should trigger the bug,
@@ -52,3 +54,66 @@
 don't need to open/close PAL several times should work fine.
 
 -- tomppa
+
+
+
+
+About performance
+--------------------------------------------------------------------------------
+Few notes about how to get the maximum graphics performance from PAL:
+
+First, if you don't notice any problems there is no need to worry about  
+performance. Using OpenGL for 2d graphics is likely to be very fast, even  
+when naively implemented and running on low-end hardware.
+
+
+Functions like draw-circle, -line and -polygon are quite slow. Normally it  
+shouldn't be problem but if you want to do complex vector graphics it  
+could. This is mostly a design issuea since PAL is more oriented towards  
+bitmap graphics, if you need faster polygon primitives let me know the  
+details and I'll see what I can do.
+
+Internally draw-image/draw-image* works by "chaining" the draw operations  
+and as long as the chain is not cut performance is very good. If the chain  
+is repeatedly cut you will get lousy performance.
+
+The chain is cut when:
+
+- You call any graphics function except draw-image or draw-image*.
+- You use any graphics state altering functions or macros (rotate, scale,  
+set-blend-mode, with-transformation etc.) except set-blend-color.
+- You draw a different image than with the previous draw-image calls.  
+Internally PAL keeps count of the "current" image and whenever it changes  
+the chain gets cut.
+- You use the :angle or :scale keywords in draw-image. That maybe fixed in  
+the future. (Also the alignment keywords cut the chain, due to my  
+laziness. I'll fix that soon.)
+
+It's okay to have rotations and image changes but to get maximum  
+performance you need to make sure they don't regularly cut the chain.
+So if you are only allowed to draw the same image again and again how you  
+get anything interesting on the screen? By tiling your graphics in one big  
+image and using the draw-image* you can avoid the need to change image and  
+in some cases you can use set-blend-color to change the color of image.
+At some point I'm going to add a mechanism for cutting images to tiles  
+which then can be used interchangebly with regular images, that should  
+make avoiding image changes much easier.
+
+
+About the examples/
+
+- teddy.lisp is an especially bad example of chaining. Since the teddies  
+all have the same image drawing them would be very fast if not
+a) when drawing the shadows with-transformation gets repeatedly called. It  
+would be better to translate the shadow position manually
+b) the teddies need to be rotated.
+
+- hares.lisp works suprisingly well altough it uses rotations and scaling.  
+It should be very fast if these wouldn't cut the chain :(
+
+Again, if you don't have any perfomance problems just ignore what I just  
+wrote :)
+
+
+-- 
+tomppa
--- /project/pal/cvsroot/pal/todo.txt	2007/10/30 20:43:10	1.20
+++ /project/pal/cvsroot/pal/todo.txt	2007/10/31 12:51:23	1.21
@@ -1,8 +1,6 @@
 TODO:
 
 
-For v1.1
-
 - Fix offsets in draw-image.
 
 - Polygon smooth hint?
@@ -13,13 +11,11 @@
 
 - Structured color values.
 
+- Utilities for interfacing with CL-Imago.
 
+- Better drawing primitives. Real lines, complex polygons, start/end args to draw-circle etc.
 
-After v1.1
-
-- Better drawing primitives, real lines, start/end args to draw-circle etc.
-
-- As always, optimise GL state handling.
+- As always, optimise GL state handling. Blitting in batches, possibly VOBs.
 
 - Implement image mirroring, tiles and animation.
 




More information about the Pal-cvs mailing list