Git Product home page Git Product logo

Comments (37)

kaveh808 avatar kaveh808 commented on May 24, 2024 1

OK. I'll comment out all calls to the text functions in minimal-ui.lisp for now and push. Then you can make a text branch.

Sound good?

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024 1

Looks good for now. test-demos.lisp works great. I will make another branch to make more tests on the text engine. If I find something, I will let you know

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

Built-in MacBook Pro display
Intel Iris Graphics 550 1536 MB

Try 1)
Did :force t and recompile.
Text appears properly. Can drag 3D camera. Hangs when clicking on close window widget.

Try 2)
Text appears properly. Can drag 3D camera. Able to close window using Escape key. Re-open window. Crash when click in window:

objc[59012]: Method cache corrupted. This may be a message to an invalid object, or a memory error somewhere else.
objc[59012]: receiver 0x7f8a6489a1c0, SEL 0x7fff7b62518e, isa 0x7fff80033dd0, cache 0x7fff80033de0, buckets 0x7f8a640e1a00, mask 0x3f, occupied 0x2d
objc[59012]: receiver 192 bytes, buckets 1024 bytes
objc[59012]: selector 'timestamp'
objc[59012]: isa 'NSEvent'
objc[59012]: Method cache corrupted. This may be a message to an invalid object, or a memory error somewhere else.
fatal error encountered in SBCL pid 59012 pthread 0x1c2d2e00:
SIGABRT received.

Error opening /dev/tty: Device not configured
Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb> 

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

Platform: Devuan GNU/Linux chimaera, x86_64, SBCL 2.1.1.
Branch: main
Commit: 7ff3015
CPU: Intel Core 2 P8600 (2) @ 2.401GHz
GPU: Intel Mobile 4 Series Chipset
Machine: Thinkpad x200

I have change only the pathname to the font in function (ensure-font), line 208 in text.lisp to a font that exists on my machine. I follow the method of loading kons-9 described in README.md file.

Odd thing is, yesterday it worked. This morning I did the same thing and it did not work. Yesterday when it worked, i run:
Branch: main
Commit: 274f53d
But between this two where no commits concerning the text, so it should still work?

I have tried to load kons-9 as you said, still the same problem. Now I get some style warnings.

; wrote /home/starkaiser/.cache/common-lisp/sbcl-2.1.1.debian-linux-x64/home/starkaiser/quicklisp/local-projects/kons-9/src/graphics/glfw/minimal-ui-tmpO0OW34V4.fasl
; compilation finished in 0:00:00.188

; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/kernel/point-simd.lisp
; in: DEFUN KONS-9::POINTS-BOUNDS
;     (SETF (KONS-9::X KONS-9::BOUNDS-HI) (KONS-9::X KONS-9::P))
; --> LET* 
; ==>
;   (FUNCALL #'(SETF KONS-9::X) #:NEW1 #:BOUNDS-HI2)
; 
; caught STYLE-WARNING:
;   undefined function: (COMMON-LISP:SETF KONS-9::X)


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/plugins/heightfield.lisp
; in: DEFMETHOD KONS-9::COMPUTE-HEIGHTS (KONS-9::HEIGHTFIELD)
;     (SETF (KONS-9::Y KONS-9::P)
;             (FUNCALL (KONS-9::HEIGHT-FN KONS-9::HFIELD) (KONS-9::X KONS-9::P)
;                      (KONS-9::Z KONS-9::P)))
; --> LET* 
; ==>
;   (FUNCALL #'(SETF KONS-9::Y) #:NEW1 #:P15)
; 
; caught STYLE-WARNING:
;   undefined function: (COMMON-LISP:SETF KONS-9::Y)


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/kernel/point-simd.lisp
; in: DEFUN KONS-9::POINTS-BOUNDS
;     (SETF (KONS-9::Y KONS-9::BOUNDS-HI) (KONS-9::Y KONS-9::P))
; --> LET* 
; ==>
;   (FUNCALL #'(SETF KONS-9::Y) #:NEW1 #:BOUNDS-HI3)
; 
; caught STYLE-WARNING:
;   undefined function: (COMMON-LISP:SETF KONS-9::Y)

;     (SETF (KONS-9::Z KONS-9::BOUNDS-HI) (KONS-9::Z KONS-9::P))
; --> LET* 
; ==>
;   (FUNCALL #'(SETF KONS-9::Z) #:NEW1 #:BOUNDS-HI4)
; 
; caught STYLE-WARNING:
;   undefined function: (COMMON-LISP:SETF KONS-9::Z)


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/graphics/opengl/opengl.lisp
; in: DEFUN KONS-9::SET-THEME-BRIGHT
;     (SETF (KONS-9::FG-COLOR KONS-9::*DRAWING-SETTINGS*) (KONS-9::C! 0 0 0))
; ==>
;   (LET* ((#:*DRAWING-SETTINGS*0 KONS-9::*DRAWING-SETTINGS*)
;          (#:NEW1 (KONS-9::C! 0 0 0)))
;     (FUNCALL #'(SETF KONS-9::FG-COLOR) #:NEW1 #:*DRAWING-SETTINGS*0))
; 
; caught WARNING:
;   undefined variable: KONS-9::*DRAWING-SETTINGS*

; in: DEFUN KONS-9::SET-LINES-THICK
;     (SETF (KONS-9::POINT-SIZE KONS-9::*DRAWING-SETTINGS*) 7.0)
; ==>
;   (LET* ((#:*DRAWING-SETTINGS*0 KONS-9::*DRAWING-SETTINGS*) (#:NEW1 7.0))
;     (FUNCALL #'(SETF KONS-9::POINT-SIZE) #:NEW1 #:*DRAWING-SETTINGS*0))
; 
; caught WARNING:
;   undefined variable: KONS-9::*DRAWING-SETTINGS*

; in: DEFUN KONS-9::SET-LINES-THIN
;     (SETF (KONS-9::POINT-SIZE KONS-9::*DRAWING-SETTINGS*) 3.0)
; ==>
;   (LET* ((#:*DRAWING-SETTINGS*0 KONS-9::*DRAWING-SETTINGS*) (#:NEW1 3.0))
;     (FUNCALL #'(SETF KONS-9::POINT-SIZE) #:NEW1 #:*DRAWING-SETTINGS*0))
; 
; caught WARNING:
;   undefined variable: KONS-9::*DRAWING-SETTINGS*

; 
; caught WARNING:
;   5 more uses of undefined variable KONS-9::*DRAWING-SETTINGS*


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/graphics/opengl/text.lisp
; in: DEFUN KONS-9::RUN-1
;     (KONS-9:SHOW-WINDOW KONS-9:*SCENE*)
; 
; caught WARNING:
;   undefined variable: KONS-9:*SCENE*

; in: DEFUN KONS-9::TEXT-ENGINE-END-FRAME
;     (ELT KONS-9::*WINDOW-SIZE* 0)
; 
; caught WARNING:
;   undefined variable: KONS-9::*WINDOW-SIZE*


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/graphics/opengl/opengl.lisp
; in: DEFUN KONS-9::2D-SETUP-PROJECTION
;     (FIRST KONS-9::*WINDOW-SIZE*)
; 
; caught WARNING:
;   undefined variable: KONS-9::*WINDOW-SIZE*


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/plugins/poly-mesh.lisp
; in: DEFMETHOD KONS-9::VERIFY-TOPOLOGY (KONS-9::POLY-MESH)
;     (KONS-9::NEQ KONS-9::VERTEX (KONS-9::VERTEX (KONS-9::PM-EDGE KONS-9::VERTEX)))
; 
; caught STYLE-WARNING:
;   undefined function: KONS-9::NEQ


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/kernel/point-cloud.lisp
; in: DEFUN KONS-9::MAKE-RANDOM-POINTS
;     (KONS-9::P-RAND2 KONS-9::BOUNDS-LO KONS-9::BOUNDS-HI)
; 
; caught STYLE-WARNING:
;   undefined function: KONS-9::P-RAND2


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/kernel/point-simd.lisp
; in: DEFUN KONS-9::P-RAND1
;     (KONS-9::P-RAND2 (KONS-9::P-NEGATE KONS-9::P) KONS-9::P)
; 
; caught STYLE-WARNING:
;   undefined function: KONS-9::P-RAND2


; file: /home/starkaiser/quicklisp/local-projects/kons-9/src/plugins/dynamics-animator.lisp
; in: DEFMETHOD KONS-9::FIELD-VALUE (KONS-9::NOISE-FORCE-FIELD T T)
;     (KONS-9::P-SCALE KONS-9::POINT (KONS-9::NOISE-FREQUENCY KONS-9::FIELD))
; 
; caught STYLE-WARNING:
;   undefined function: KONS-9::P-SCALE
; 
; compilation unit finished
;   Undefined functions:
;     (SETF KONS-9::X) (SETF KONS-9::Y) (SETF KONS-9::Z) KONS-9::NEQ KONS-9::P-RAND2 KONS-9::P-SCALE
;   Undefined variables:
;     KONS-9::*DRAWING-SETTINGS* KONS-9:*SCENE* KONS-9::*WINDOW-SIZE*
;   caught 7 WARNING conditions
;   caught 12 STYLE-WARNING conditions
#<ASDF/LISP-ACTION:LOAD-OP >

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

The p-scale was a bug and I just pushed a fix.

Not sure why you're seeing the other warnings.

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

Tried with the latest source. Still no luck.

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

Found a bug in point-simd. give me a few to fix it.

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

Pushed. Try again?

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

Same problem. I also get this if I run SBCL from terminal

corrupted size vs. prev_size
fatal error encountered in SBCL pid 3768 tid 3768:
SIGABRT received.

Welcome to LDB, a low-level debugger for the Lisp runtime environment.

What I did:

  1. clone the repository
  2. change the pathname in text.lisp, line 208 to point to a font on my machine
  3. (ql:quickload "kons-9")
  4. (in-package :kons-9)
  5. (run)
    Also tried to load the project as the @awolven sugested and I get the same result. I will do some more tests and investigations. Maybe I can provide you guys with more relevant info. I don't understand how yesterday it worked.

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

Try 3)

[The way I get different behavior each time makes me wonder if something is not properly initialized.]

Window opens and immediately crashes.

2.1
Date/time: 2022-09-03-10:18!
An unhandled error condition has been signalled: Unhandled memory fault at #x0.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10016C80A3}>
0: ("bogus stack frame")
1: ("foreign function: _copyResourceURLsFromBundle")
2: ("foreign function: _CFBundleCopyFindResources")
3: ("foreign function: CFBundleCopyResourceURL")
4: ("foreign function: -[NSBundle URLForResource:withExtension:subdirectory:]")
5: ("foreign function: __58+[NSImage(NSSymbolImages) _symbolCompatibilityImageNamed:]_block_invoke")
6: ("foreign function: _dispatch_client_callout")
7: ("foreign function: _dispatch_once_callout")
8: ("foreign function: +[NSImage(NSSymbolImages) _symbolCompatibilityImageNamed:]")
9: ("foreign function: +[NSImage _systemImageNamed:]")
10: ("foreign function: +[NSImage imageNamed:]")
11: ("foreign function: -[NSApplication(NSWindowsMenu) updateWindowsItem:]")
12: ("foreign function: -[NSWindow becomeKeyWindow]")
13: ("foreign function: _NXShowKeyAndMain")
14: ("foreign function: -[NSApplication _handleActivatedEvent:]")
15: ("foreign function: -[NSApplication(NSEvent) sendEvent:]")
16: ("foreign function: _glfwPlatformPollEvents")
17: (%CL-GLFW3:POLL-EVENTS)
18: (KONS-9:SHOW-WINDOW #<KONS-9::SCENE , frame bounds: 0 240, current: 0 {100740C2A3}>)
19: ((:METHOD SIMPLE-TASKS:RUN-TASK (SIMPLE-TASKS:CALL-TASK)) #<SIMPLE-TASKS:CALL-TASK :FUNC #<FUNCTION (LAMBDA NIL :IN KONS-9:RUN) {538FB28B}> :STATUS :RUNNING {10072C8D73}>) [fast-method]

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

@starkaiser I found and fixed all the problems you were having with undefined symbols earlier today. My apologies. Let me know if you continue to have any issues.

from kons-9.

robotjunkyard avatar robotjunkyard commented on May 24, 2024

Platform and Lisp: Linux Mint 20.3 x86_64, SBCL 2.2.5

I am getting this too, using commit a7f20b0. The only local code I changed was making ensure-font's optional parameter be (pathname "./monaco.ttf"), pointing to a locally-copied version of the monaco font, instead of the other path (I presume that's a MacOS-style path)

I tried (asdf:oos 'asdf:load-op :kons-9 :force t) as someone suggested in this discussion earlier, but that results in the compiler giving errors warning about some functions and global variables being undefined, whereas it didn't do that with the Quicklisp-based steps in the readme:

; caught STYLE-WARNING:
;   undefined function: KONS-9::NEQ
; 
; compilation unit finished
;   Undefined function:
;     KONS-9::NEQ
;   Undefined variables:
;     KONS-9::*DRAWING-SETTINGS* KONS-9:*SCENE* KONS-9::*WINDOW-SIZE*
;   caught 9 WARNING conditions
;   caught 6 STYLE-WARNING conditions

from kons-9.

robotjunkyard avatar robotjunkyard commented on May 24, 2024

In the function show-window, adding a (format t "blahblahblah A, B, C...") trace output line before each line that's in the function's primary loop shows that only the text before (draw-scene-view *default-scene-view*) gets printed before the whole thing apparently seems to just stall.

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

Branch: main
Commit: a7f20b0
@kaveh808 Unfortunately that did not fix the problem with the black window.
But I have managed to track down the problem. I put (format t "Breakpoint ...~%") repeatedly after each instruction, following the order in which the functions were called to see where the program would get stuck. The problem seems to be in (render-draw-lists) and (setup-render-state)

In (setup-render-state) I had to comment the following lines in order for the program to successfully exit the function:
(gl:enable :scissor-test)
(gl:enable-client-state :vertex-array)
(glEnable_foo GL_TEXTURE_2D)
(gl:polygon-mode :front-and-back :fill)
(gl:load-identity)

(gl:ortho display-pos-x (+ display-pos-x display-size-x)
	    (+ display-pos-y display-size-y) display-pos-y
	    -1.0 1.0)

After I did that, the program would exit (setup-render-state) and get stuck in the loop in (render-draw-lists). I think it has something to do with the recursive call.

But I have managed to make it work without modifications in (setup-render-state). What I found out is that if in the function (test-text) are only two calls to (render-text) the program works and will display two strings as expected. When I add another call to (render-text) the program breaks with the following error:

An unhandled error condition has been signalled:
   Unhandled memory fault at #x55CEFE28D008.


Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10018809E3}>
0: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE-TO-STREAM #<SYNONYM-STREAM :SYMBOL SWANK::*CURRENT-DEBUG-IO* {1001880CC3}>)
1: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE #<SB-SYS:MEMORY-FAULT-ERROR {100320FFB3}> :OUTPUT NIL :IF-EXISTS :APPEND :VERBOSE NIL)
2: ((FLET "H0" :IN KONS-9:SHOW-WINDOW) #<SB-SYS:MEMORY-FAULT-ERROR {100320FFB3}>)
3: (SB-KERNEL::%SIGNAL #<SB-SYS:MEMORY-FAULT-ERROR {100320FFB3}>)
4: (ERROR SB-SYS:MEMORY-FAULT-ERROR :ADDRESS 94347515711496)
5: (SB-SYS:MEMORY-FAULT-ERROR #<unused argument> #.(SB-SYS:INT-SAP #X55CEFE28D008))
6: ("foreign function: call_into_lisp")
7: ("foreign function: funcall2")
8: ("foreign function: handle_memory_fault_emulation_trap")
9: ("foreign function: #x55CEFB8A2061")

It seems that the third call to (render-text) breaks to program, somewhere in (setup-render-state) or in the loop in (render-draw-lists). I will investigate further.
@robotjunkyard can you comment one call to (render-text) in text.lisp to see if it works for you? (line 588 in src/graphics/opengl/text.lip)

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

My bad, it is not a recursive call, it is another function with a similar name: render-draw-list and not render-draw-lists
I will try to find if render-draw-list is the problem

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

In one of my crashes, I got the following stack trace:

An unhandled error condition has been signalled: Unhandled memory fault at #x0.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001680143}>
0: ("bogus stack frame")
1: ("foreign function: gleBindTexture")
2: ("foreign function: glBindTexture_Exec")
3: (KONS-9::RENDER-DRAW-LIST #S(KONS-9::DRAW-LIST :CMD-BUFFER #(#S(KONS-9::DRAW-CMD :ELE
4: (KONS-9::RENDER-DRAW-LISTS (#S(KONS-9::DRAW-LIST :CMD-BUFFER #(#S(KONS-9::DRAW-CMD :E
5: (KONS-9::TEXT-ENGINE-END-FRAME)
6: ((:METHOD KONS-9::DRAW-SCENE-VIEW (KONS-9::SCENE-VIEW)) #<KONS-9::SCENE-VIEW {1003172533}>) [fast-method]
7: (KONS-9:SHOW-WINDOW #<KONS-9::SCENE , frame bounds: 0 240, current: 0  {10060AF463}>)

from kons-9.

robotjunkyard avatar robotjunkyard commented on May 24, 2024

@robotjunkyard can you comment one call to (render-text) in text.lisp to see if it works for you? (line 588 in src/graphics/opengl/text.lip)

I did this, and it no longer hangs. I finally see a window with a workspace in it:

image

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

@kaveh808 You too have the crash when there are three calls in (test-text)? Does it work with two calls?

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

@starkaiser Yes I do. Seems to be ok with two calls.

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

Then maybe you can comment one call and push the changes to main so we can have a working setup? And we can make another branch to make further tests on the text engine and solve the issue

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

@starkaiser Pushed. Please test and let me know.

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

@starkaiser @robotjunkyard Can you please test the text-engine branch? Andrew has fixed the crash bug.

You will still need to set the ttf font pathname by hand.

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

robotjunkyard avatar robotjunkyard commented on May 24, 2024

@starkaiser @robotjunkyard Can you please test the text-engine branch? Andrew has fixed the crash bug.

You will still need to set the ttf font pathname by hand.

I am able to run this now without it immediately crashing

from kons-9.

starkaiser avatar starkaiser commented on May 24, 2024

kons-9
Now it works!

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

Thanks for testing, guys. Looking forward to the beginnings of a GUI.

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

@JMC-design I'd like to submodule your font and font-zpb-ttf repos for use in @awolven's text engine. Would that be okay with you?

I'm not sure how to do this, so I'll have to do some digging. Or if someone knows how to do it, I'd appreciate it.

The latest text engine is at awolven/kons-9/main and I'm going to merge it into kaveh808/kons-9/text-engine for testing.

from kons-9.

JMC-design avatar JMC-design commented on May 24, 2024

I'm not sure what submoduling entails. If it's just for ease of install, I'd suggest kons-9 be added to ultralisp, both those repos are on the default ultralisp distro. Then again, I also think EASING should be a dependency and not just copied into the code base.

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

Submodules were suggested a while back, and again recently, as the recommended way of bringing an external repo into our project. My understanding is that it creates a snapshot of the repo in our repo, and we can make local changes as necessary. Need to figure out the details.

For example, there are a couple of things we need to do for our text tests, per Andrew:

"It would be nice if someone looked into the bugs with zpb-ttf metrics. I'm having to generate the bitmaps twice, first to get the metrics needed to map the glyphs onto an atlas, and then to actually copy the bitmaps over. The metrics are different between what the glyph says and what the bitmap says."

And:

"You have to delete the last definition of code-points in font-zpb-ttf.lisp otherwise it won't work."

from kons-9.

JMC-design avatar JMC-design commented on May 24, 2024

Well, the proper way to resolve that would be to raise an issue in the repo or just talk to me.
The metrics will always return the precise measurements. Glyph:raster returns 3 values, the alpha mask, the actual size of the bitmap, and the offset. I've changed the documentation to reflect that.

from kons-9.

kaveh808 avatar kaveh808 commented on May 24, 2024

@awolven Does that address your first issue above?

What about having to delete a definition in the file? If we can avoid having to modify the files we can do as @JMC-design suggests and pull them in via ultralisp.

from kons-9.

awolven avatar awolven commented on May 24, 2024

from kons-9.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.