Hello!
I've just finished a substantial project in which I tried lots of new
Lisp things (for me, that is): foreign libraries, GUI, serial port
programming, process spawning etc. It's a real time scientific data
visualisation program, and I am pleased to say that Lisp version is
faster than C++ one.
Attached is the patch (result of darcs send -o) with modifications that
I made to cl-opengl in the process. It includes Charlie MacMackin's
vertex array patch.
Hope it will be useful.
Sincerely yours,
Dmitri
New patches:
[some changes
[EMAIL PROTECTED] {
hunk ./gl/funcs.lisp 91
+(defglfun ("glBitmap" %glBitmap) :void
+ (width sizei)
+ (height sizei)
+ (xorig float)
+ (yorig float)
+ (xmove float)
+ (ymove float)
+ (bitmap :pointer))
+
hunk ./gl/funcs.lisp 104
+
hunk ./gl/funcs.lisp 334
+(defglfun ("glDrawPixels" %glDrawPixels) :void
+ (width sizei)
+ (height sizei)
+ (format enum)
+ (type enum)
+ (data :pointer))
+
+
hunk ./gl/funcs.lisp 1156
+
+(defglfun ("glArrayElement" %glArrayElement) :void
+ (i int))
+
+
+(defglfun ("glClientActiveTexture" %glClientActiveTexture) :void
+ (texture enum))
+
+
+(defglfun ("glColorPointer" %glColorPointer) :void
+ (size int)
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glDisableClientState" %glDisableClientState) :void
+ (array enum))
+
+(defglfun ("glDisableVertexAttribArray" %glDisableVertexAttribArray) :void
+ (index uint))
+
+(defglfun ("glDrawArrays" %glDrawArrays) :void
+ (mode enum)
+ (first int)
+ (count sizei))
+
+
+(defglfun ("glDrawElements" %glDrawElements) :void
+ (mode enum)
+ (count sizei)
+ (type enum)
+ (indices :pointer))
+
+
+(defglfun ("glEdgeFlagPointer" %glEdgeFlagPointer) :void
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glEnableClientState" %glEnableClientState) :void
+ (array enum))
+
+(defglfun ("glEnableVertexAttribArray" %glEnableVertexAttribArray) :void
+ (index uint))
+
+
+(defglfun ("glFogCoordPointer" %glFogCoordPointer) :void
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glIndexPointer" %glIndexPointer) :void
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glInterleavedArrays" %glInterleavedArrays) :void
+ (frmat enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glNormalPointer" %glNormalPointer) :void
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glSecondaryColorPointer" %glSecondaryColorPointer) :void
+ (size int)
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glTexCoordPointer" %glTexCoordPointer) :void
+ (size int)
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
+
+(defglfun ("glVertexAttribPointer" %glVertexAttribPointer) :void
+ (index uint)
+ (size int)
+ (type enum)
+ (normalized boolean)
+ (stride sizei)
+ (pointer :pointer))
+
+(defglfun ("glVertexPointer" %glVertexPointer) :void
+ (size int)
+ (type enum)
+ (stride sizei)
+ (pointer :pointer))
+
hunk ./gl/opengl.lisp 125
+;;;
+;;; 2.8 Vertex Arrays
+;;;
+
+(defun vertex-pointer (size type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glVertexPointer size type stride array)))
+
+(defun normal-pointer (type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glNormalPointer type stride array)))
+
+(defun color-pointer (size type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glColorPointer size type stride array)))
+
+(defun secondary-color-pointer (size type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glSecondaryColorPointer size type stride array)))
+
+(defun index-pointer (type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glIndexPointer type stride array)))
+
+(defun edge-flag-pointer (stride lisp-array)
+ (with-opengl-sequence (array 'boolean lisp-array)
+ (%glEdgeFlagPointer stride array)))
+
+(defun fog-coord-pointer (type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glFogCoordPointer type stride array)))
+
+(defun tex-coord-pointer (size type stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glTexCoordPointer size type stride array)))
+
+(defun vertex-attrib-pointer (index size type normalized stride lisp-array)
+ (with-opengl-sequence (array type lisp-array)
+ (%glVertexAttribPointer index size type normalized stride array)))
+
+(declaim (inline enable-client-state))
+(defun enable-client-state (state)
+ (%glEnableClientState state))
+
+(declaim (inline disable-client-state))
+(defun disable-client-state (state)
+ (%glDisableClientState state))
+
+(declaim (inline client-active-texture))
+(defun client-active-texture (enum)
+ (%glClientActiveTexture enum))
+
+(declaim (inline array-element))
+(defun array-element (i)
+ (%glArrayElement i))
+
+(declaim (inline draw-arrays))
+(defun draw-arrays (mode first count)
+ (%glDrawArrays mode first count))
+
+;; (defun multi-draw-arrays ())
+
+(defun draw-elements (mode count type lisp-indices)
+ (with-opengl-sequence (indices type lisp-indices)
+ (%glDrawElements mode count type indices)))
+
+;; (defun draw-range-elements ())
+
+(defun interleaved-arrays (format stride lisp-array)
+ ;;array type needs more logic I think
+ ;;float is quick hack to get working with redbook varray example
+ (with-opengl-sequence (array 'float lisp-array)
+ (%glInterleavedArrays format stride array)))
+
hunk ./gl/opengl.lisp 567
+
hunk ./gl/package.lisp 42
+ #:pixel-store
hunk ./gl/package.lisp 66
+ ;; 2.8 Vertex Arrays
+ #:vertex-pointer
+ #:normal-pointer
+ #:color-pointer
+ #:secondary-color-pointer
+ #:index-pointer
+ #:edge-flag-pointer
+ #:fog-coord-pointer
+ #:tex-coord-pointer
+ #:vertex-attrib-pointer
+ #:enable-client-state
+ #:disable-client-state
+ #:client-active-texture
+ #:array-element
+ #:draw-arrays
+;; #:multi-draw-arrays
+ #:draw-elements
+;; #:multi-draw-elements
+;; #:draw-range-elements
+ #:interleaved-arrays
hunk ./gl/package.lisp 253
+ ;;
+ #:draw-pixels
hunk ./gl/util.lisp 109
+
+(defun convert-seq (type lisp-sequence)
+ (case type
+ ((float :float) (map (type-of lisp-sequence) #'float lisp-sequence))
+ ((double :double) (map (type-of lisp-sequence)
+ #'(lambda (x) (float x 1.0d0)) lisp-sequence))
+ (t lisp-sequence)))
+
hunk ./gl/util.lisp 121
- (flet ((converting (form) ; um, assuming type is constant
+#| (flet ((converting (form) ; um, assuming type is constant
hunk ./gl/util.lisp 133
- ,@body))))))
+ ,@body))))))|#
+ (let ((count (gensym "COUNT"))
+ (typed-seq (convert-seq type lisp-sequence)))
+ (once-only (type typed-seq)
+ `(let ((,count (length ,typed-seq)))
+ (with-foreign-object (,var ,type ,count)
+ (loop for i below ,count
+ do (setf (mem-aref ,var ,type i)
+ (elt ,typed-seq i)))
+ ,@body)))))
hunk ./gl/util.lisp 178
+
hunk ./glu/glu.lisp 129
- (%gluPickMatrix x y delta-x delta-y array)))
+ (%gluPickMatrix x (- (elt viewport 3) y) delta-x delta-y array)))
hunk ./glu/glu.lisp 217
- (%gluUnProject win-x win-y win-z modelview projection viewport x y z))))
+ (%gluUnProject win-x (- (mem-aref viewport 'gl:int 3) win-y) win-z modelview projection viewport x y z))))
}
Context:
[Misc patch
Luis Oliveira <[EMAIL PROTECTED]>**20061117024105
Patch courtesy of Bart Botta.
]
[Applied patch from Bart Botta
Oliver Markovic <[EMAIL PROTECTED]>**20061112111533]
[Pushed wrong version of render-to-texture.lisp; fixed
Oliver Markovic <[EMAIL PROTECTED]>**20061111152828]
[Add render-to-texture example
Oliver Markovic <[EMAIL PROTECTED]>**20061111151241
- Add new example in examples/misc/ illustrating the use of FBOs
]
[Add support for buffer objects
Oliver Markovic <[EMAIL PROTECTED]>**20061111151103
- Add vertex and pixel buffer objects
- Add support for the EXT_framebuffer_object extension
]
[Fix downcasing issues with enum generation.
James Bielman <[EMAIL PROTECTED]>**20060830200239]
[Implement GLU projection functions.
James Bielman <[EMAIL PROTECTED]>**20060828054332
- New exported functions: GLU:PROJECT, GLU:UN-PROJECT, GLU:UN-PROJECT4.
- New utility macro: WITH-OPENGL-ARRAYS for binding multiple arrays.
]
[Implement numeric OpenGL state querying functions.
James Bielman <[EMAIL PROTECTED]>**20060828054131
- New exported functions: GET-BOOLEAN, GET-DOUBLE, GET-FLOAT,
GET-INTEGER, and GET-ENUM. These functions are able to automatically
return the correct number of return values when the query enum is
in the *QUERY-ENUM-SIZES* table.
]
[Replace separate enum types with generated GL:ENUM.
James Bielman <[EMAIL PROTECTED]>**20060828052308]
[Add a script to generate OpenGL constants from the specifiction.
James Bielman <[EMAIL PROTECTED]>**20060828051427]
[Add OpenGL specification data files for enum values.
James Bielman <[EMAIL PROTECTED]>**20060828051348]
[Define foreign functions inline via DEFGLFUN helper macro.
James Bielman <[EMAIL PROTECTED]>**20060828045747]
[Move GL function DEFCFUNs into funcs.lisp.
James Bielman <[EMAIL PROTECTED]>**20060828045514]
[More 64-bit-cleanliness fixes, use ints instead of longs.
James Bielman <[EMAIL PROTECTED]>**20060828044816]
[Fix bug in WITH-OPENGL-ARRAY when VAR and LISP-ARRAY are the same.
James Bielman <[EMAIL PROTECTED]>**20060823210517]
[Use :INT as the base type for GL:INT and GL:SIZEI.
James Bielman <[EMAIL PROTECTED]>**20060823171453
- Using :LONG broke on 64-bit Linux. According to the GL header on my
Linux system, GLint and GLsizei are of C type 'int'.
]
[Minor fix to glut/interface.lisp
Luis Oliveira <[EMAIL PROTECTED]>**20060703224124]
[CL-GLUT update
Luis Oliveira <[EMAIL PROTECTED]>**20060624235928
- Fix foreign-symbol-pointer usage in glut/fonts.lisp.
- Move enums next to the DEFCFUNs where they're used.
- Rework the CL-GLUT CLOS interface.
- Reorganize examples and rewrite them using the updated CLOS interface.
]
[s/windows/cffi-features:windows
Luis Oliveira <[EMAIL PROTECTED]>**20060425212810]
[Convert array contents to floats in MAP1 and MAP2.
James Bielman <[EMAIL PROTECTED]>**20060412015458]
[Add evaluator constants to the ENABLE-CAP enum.
James Bielman <[EMAIL PROTECTED]>**20060412015045]
[New example: glut-teapot.lisp
Luis Oliveira <[EMAIL PROTECTED]>**20060326211537
Also, fixed a typo in the README and added a README for the examples.
]
[GLUT: add missing event and fix typo
Luis Oliveira <[EMAIL PROTECTED]>**20060221054305
- Missing event: passive-motion.
- fullscreen -> full-screen
- move the (setf title) magic to a :before method.
]
[Minor fixes to the examples
Luis Oliveira <[EMAIL PROTECTED]>**20060221054151
- add ignore declarations to unused arguments.
- use MOD!
]
[Oops. Forgot to darcs add examples/mesademos/package.lisp
Luis Oliveira <[EMAIL PROTECTED]>**20060219211853]
[More examples
Luis Oliveira <[EMAIL PROTECTED]>**20060218054241
- New examples: rb{6,7,8,9,10,11,12,13}.
- Use with-new-list in mesademos/gears.lisp.
- Add copyright notices to examples.
- Fix example 4 which was drawing *halftone* twice.
]
[with-new-list, with-primitive and call-lists
Luis Oliveira <[EMAIL PROTECTED]>**20060218051830]
[GLUT: use gl:ensure-double
Luis Oliveira <[EMAIL PROTECTED]>**20060217231013]
[Small change to with-opengl-sequence
Luis Oliveira <[EMAIL PROTECTED]>**20060217224915
- Make it convert the sequence's elements to float or double
when the type is gl:float or gl:double respectively. Breaks
when type isn't constant, oops.
]
[Tiny update to GLU
Luis Oliveira <[EMAIL PROTECTED]>**20060217222227
- Mostly move files around. (remind not to create stub files again, ugh)
- Added some new functions.
]
[New types: gl:ensure-double and gl:ensure-float
Luis Oliveira <[EMAIL PROTECTED]>**20060217221729
- Define and export ensure-double and ensure-float. (these need a recent
CFFI)
- Also export some types that'll be needed for GLU. Maybe a gl-types
package would be a good idea?
]
[Oops. Forgot darcs add.
Luis Oliveira <[EMAIL PROTECTED]>**20060207034827]
[New examples
Luis Oliveira <[EMAIL PROTECTED]>**20060207032245
- New 5 examples from the redbook.
- 2 GLU functions needed for the examples.
- Added gl:polygon-stipple needed for one of the examples.
- Fixed silly bugs in cl-glut's ascii-to-char type and
the base-window initialize-instance.
- Moved window's title initform to a special.
]
[Preliminary CLOS interface to GLUT
Luis Oliveira <[EMAIL PROTECTED]>**20060206182638
- Removed a german 'ss' from rasterization.lisp which was upsetting SBCL.
- New macro WITH-PUSHED-MATRIX. WITH-MATRIX might be a better name?
- New experimental CLOS-based interface to GLUT.
- New example using the new CLOS interface. Moved old gears exmample
to gears-raw.lisp.
]
[Optimizations (needs recent CFFI again)
Luis Oliveira <[EMAIL PROTECTED]>**20060203014020
- Add declarations in gears.lisp
- Define the gl:* types to have no translation
]
[Use internal-time-units-per-second
Luis Oliveira <[EMAIL PROTECTED]>**20060202200413]
[Add fps counter to examples/mesademos/gears.lisp
Luis Oliveira <[EMAIL PROTECTED]>**20060202195354]
[Texturing functions added.
Oliver Markovic <[EMAIL PROTECTED]>**20060202185907
- Added preliminary support for glTexImage and glTexSubImage. I'm still not sure
on how to handle the data.
- Added glCopyTexImage and glCopyTexSubImage
- Added glAreTexturesResident and glPrioritizeTextures along with TEXTURE-RESIDENT-P
and PRIORITIZE-TEXTURE, which are hopefully less awkward to use than the direct
translations.
- Added glTexEnv.
]
[Oops. Missing glut/main.lisp file.
Luis Oliveira <[EMAIL PROTECTED]>**20060202190632]
[GLUT update, less straw.
Luis Oliveira <[EMAIL PROTECTED]>**20060202124342
(requires recent cffi patches fixing defcenum issue and
implementing defbitfield)
- add missing depends-on to funcs in cl-opengl.asd
- complete glut bindings. next step: high level interface.
]
[Add glutSetOption.
Alexey Dvoychenkov <[EMAIL PROTECTED]>**20060202031904]
[Big patch, lots of straw again.
Luis Oliveira <[EMAIL PROTECTED]>**20060201164339
- GLU: added asd file and stub .lisp files.
- Examples:
- added cl-glut-examples.asd
- new example: gears.lisp
- GLUT: added asd file and implemented a few routines. (mostly those
needed by the gears.lisp example)
- Add my name to HEADER too.
- 3 separate manuals is probably overkill? Use only one for now.
- GL:
- fixed enums, these should canonicalize to GLenum, not int.
- renamed gl types from GLfoo to gl:foo (and exported them)
- fixed erroneus check-type.
- look for libGL.so.N if libGL.so isn't found.
- removed some tabs from the files.
- added missing space between ":constant-attenuation" and
"linear-attenuation".
- added missing (declare (ignore ..)) to avoid warnings.
- fixed a small bug/typo where a foreign array was being accessed
as if it were Lisp array.
- change ;;;-comments to ;;-comments in package.lisp in order to
indent well.
]
[Add documentation structure.
Luis Oliveira <[EMAIL PROTECTED]>**20060201013908
Just straw, no content. Taken from cffi mostly.
]
[Minor changes
Luis Oliveira <[EMAIL PROTECTED]>**20060131190956
- added HEADER file.
- changed library.lisp to use BSD license.
- removed tabs from state.lisp
]
[Added examples directory.
Oliver Markovic <[EMAIL PROTECTED]>**20060131120521]
[Initial revision.
Oliver Markovic <[EMAIL PROTECTED]>**20060131115438]
Patch bundle hash:
2753c9a5c29e895e446301f4ef5a773016dc344e
_______________________________________________
cl-opengl-devel mailing list
cl-opengl-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cl-opengl-devel