Closed tiwe0 closed 1 year ago
Hi, sorry, I haven't had time to look at this until now. I'm not sure what's wrong, can you try again with the latest patches and report the error?
Hi, thanks for your reply!
(ql:update-all-dists)
, but it still doesn't work with the same error.I am using a Mac(M1). Does that matter?
Here is my test project.
The tilemap contains 20x30=600 tiles. For each tile, the code transforms the GID into a position (x,y). So, I understand the number 1200. But I do not understand 2400.
when the lenght of data is less than 600, it complains:
Trying to upload a region bigger than there is data in the image.
Region is
2400
image is
1200
when the length of data is greater than 600, it complains:
Invalid index 1200 for (SIMPLE-ARRAY (UNSIGNED-BYTE 8)
(1200)), should be a non-negative integer below 1200.
I am not familiar with OpenGL. Maybe I just made some stupid mistake.
Best wishes.
Hi, sorry to bother you again, I just noticed the patches.
Here is the error information:
Trying to upload a region bigger than there is data in the image.
Region is:
2400 bytes,
0 , 0 , 0
30 x 20 x NIL
RGBA RGBA
image is
UNSIGNED-BYTE bytes
1200 , 0 , 0
0 x 30 x 20 @ NIL
RGBA UNSIGNED-BYTE
It seems that there is a typo in the patches on line 194 in file texture-source.lisp
.
(+ off len) src-x src-y src-z src-w src-h src-d format format type
(memory-region-size region) dst-x dst-y dst-z dst-w dst-h dst-d (pixel-format texture) (pixel-type texture)))
I change it to
(+ off len) src-x src-y src-z src-w src-h src-d format type
(memory-region-size region) dst-x dst-y dst-z dst-w dst-h dst-d (pixel-format texture) format (pixel-type texture)))
Here is the error informathion again:
Trying to upload a region bigger than there is data in the image.
Region is:
2400 bytes,
0 , 0 , 0
30 x 20 x NIL
RGBA UNSIGNED-BYTE
image is
1200 bytes
0 , 0 , 0
30 x 20 x NIL @ RGBA
RGBA UNSIGNED-BYTE
with the debuger, I found more information in upload-texture-source
:
(inspect trial::source)
The object is a STRUCTURE-OBJECT of type TRIAL:TEXTURE-SOURCE.
PIXEL-DATA: #(2 15 3 15 2 15 3 15 2 15 3 15 ...) <- with length of 1200
PIXEL-TYPE: :UNSIGNED-BYTE
PIXEL-FORMAT: :RGBA
TARGET: NIL
LEVEL: NIL
SRC: (NIL NIL NIL NIL NIL NIL)
DST: (NIL NIL NIL NIL NIL NIL)
texture
(inspect trial:texture)
The object is a STANDARD-OBJECT of type TRIAL:TILEMAP.
It seems that
for texture, len(2400) = stride(4channel) x width(30) x height(20); for source, the pixel-data is an array containing positions of each tile(1200).
Give me several days, I may figure out the solution.
df3056e7 should fix your issue.
Hi, thanks for replying!
I applied the change, but a new error was raised:
#<THREAD "main thread" RUNNING {7006360723}>:
OpenGL signaled (1282 . INVALID-OPERATION) from TEX-SUB-IMAGE-2D.
So I reviewed the code that loads the tilemap using "tilemap.dat".
It seems that there is a typo in the patches on line 55 in the file tile-data.lisp
:
:sources (list (make-image-source pixel-data width height :unsigned-byte :rg))
I changed it to:
:sources (list (make-image-source pixel-data width height :unsigned-byte :rg-integer))
And finally, it worked!
Thank you!
Hi, I am working on a game based on tilemap. I construct a tile-data.json according to the source code. But the code complains that
here is my lisp code and tile-data.json:
lisp code:
tile-data.json: json
Anything wrong?