SapphireDensetsu / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

gluUnproject expects int? #138

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. using the following code:

(define-syntax define-get-typev-enum-sugar
  (syntax-rules ( )
    ( ( _ new-op-name op-name enum ressize) ;size in bytes
      (define-syntax new-op-name
    (syntax-rules ( )
      ( (new-op-name)
        (let ((res (make-bytevector ressize)))
         (op-name enum res)
         res)))))))

(define-get-typev-enum-sugar gl-get-dv-modelview-matrix glGetDoublev
GL_MODELVIEW_MATRIX (* (c-sizeof double) 16))
(define-get-typev-enum-sugar gl-get-dv-projection-matrix glGetDoublev
GL_PROJECTION_MATRIX (* (c-sizeof double) 16))
(define-get-typev-enum-sugar gl-get-iv-viewport glGetIntegerv GL_VIEWPORT
(* (c-sizeof int) 4))

(define glu-unproject
  (case-lambda 
    ((x y z model proj view)
     (let ((resx (make-bytevector (c-sizeof double)))
       (resy (make-bytevector (c-sizeof double)))
       (resz (make-bytevector (c-sizeof double))))
       (gluUnProject (inexact x) (inexact y) (inexact z) model proj view
resx resy resz)
       (values (bytevector-c-double-ref resx 0)
           (bytevector-c-double-ref resy 0)
           (bytevector-c-double-ref resz 0))))
    ((x y z)
     (glu-unproject x y z
      (gl-get-dv-modelview-matrix)
      (gl-get-dv-projection-matrix)
      (gl-get-iv-viewport)))

    ))

2. then using (glu-unproject 1 2 3) somewhere in a glcontext

 What do you see instead?

error in gluUnProject: expected exact integer, but got #vu8(0 0 0 0 0 0 0 0
32 3 0 0 212 2 0 0), as argument 10

irritants:
  (259 3905920 gluUnProject "dddppippp" 624.0 309.0 0.0 #vu8(0 0 0 224 255
255 239 63 0 0 0 0 0 0 ...) #vu8(0 0 0 0 0 0 20 64 0 0 0 0 0 0 0 0 0 0 ...)
#vu8(0 0 0 0 0 0 0 0 32 3 0 0 212 2 0 0) #vu8(0 0 0 0 0 0 0 0) #vu8(0 0 0 0
0 0 0 0) #vu8(0 0 0 0 0 0 0 0))

backtrace:
  0  (gluUnProject (inexact x) (inexact y) (inexact z) model proj view resx
resy ...)
  ..."/home/dpara/bak/libs3d/glsugar.scm" line 139

What version of the product are you using? On what operating system?

Ypsilon 0.9.6-trunk/r503 Copyright (c) 2009 Y.Fujita, LittleWing Company
Limited.
Ubuntu 9.10

Please provide any additional information below.

From your glu.scm file, I am rather confident that the int's should not be
in there

  ;; GLint gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const
GLdouble* model, const GLdouble* proj, const GLint *view, GLdouble* objX,
GLdouble* objY, GLdouble* objZ)
  (define-function int gluUnProject (double double double void* void* int
void* void* void*))

  ;; GLint gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ,
GLdouble clipW, const GLdouble* model, const GLdouble* proj, const GLint
*view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY,
GLdouble* objZ, GLdouble* objW)
  (define-function int gluUnProject4 (double double double double void*
void* int double double void* void* void* void*))

I removed the int from the usr/share/ypsilon/sitelib/ypsilon/glu.scm file,
but the error survived maybe i forgot to clear a cache? or is it my bad :)?

Original issue reported on code.google.com by exor...@aon.at on 1 Apr 2010 at 2:21