@Sadeep Darshana I finally got a Windows build of qged, and I can confirm I see the same errors. The _close bit is definitely coming from our config_win.h "#define close _close", so I need to track down where we're getting common.h into the mix.
Is it working in the current revision?
No, not yet - I need to drill in a bit and figure out where the various problems are coming from.
As an interim measure you might try setting up a small test application that just exercises the accordion widget in isolation
It's not supposed to be tied to qged specifically, so if it is that'd be something to fix
r76204 may help the qged build - it's not tested on Windows yet
I'll check.
Btw @starseeker what is qged? I'm curious because it might help the project I'm working on.
It's an effort I made some years ago to frame out an Archer-like graphical interface in Qt. It was a relatively quick effort - ~2-3 weeks work all told. I had just taken a training course and wanted to apply what I'd learned while still fresh.
It doesn't have the most important piece - a display manager/framebuffer widget for the central view - but it has the beginnings of a tree view, a console widget, and tool palette buttons similar to those in in the GNU image manipulation program and similar tools which are intended to eventually offer up various interactive tool selection and control features.
Can also display man pages in an html widget - "man search" will work, although the color scheme is a bit weird right now because I overrode the style sheets globally to get that grey look.
Most of what's in there is "proof of concept" stage, and will need considerable refinement and polish to be truly useful.
The console widget experiments with using html widgets to display output - it has a cute trick where search full path outputs (i.e. from "search /") can be clicked on to open and select the corresponding instances in the tree view.
Cool. Sounds like it will be helpful to me.
The work I just committed to trunk is intended (among other things) to set the stage for a Qt based dm/fb backend plugin and widget that can form the central widget of the qged interface. There's not much Qt specific work as yet (and what is there probably doesn't work now, if it ever did) but the ground should now be prepared.
great, I will have a look. I was working on a qt based DM too.
What I have build so far is a lot simpler than what you'd find in a DM in libdm though
Here's a quick visual demo of what's currently in qged (once it compiles - this is from a Linux machine)
https://brlcad.org/~starseeker/qged_demo.gif
Wow, that is great. I didn't know this existed
I just created a simple thing that displays the geometry image.png
can rotate zoom move
Cool - maybe you can get that to embed as the central widget
yeah, I'll try to do that
OK, I think I see - it's not the header order specifically, but simply the combination. Hmm...
Just learned a useful trick for showing the include tree with MSVC: https://stackoverflow.com/a/1138045
+1
@Sadeep Darshana OK - I haven't cleared the qmath.h warnings, but I think I've gotten the out-and-out errors - I managed to get a build on MSVC 2017 of qged with what should be an equivalent to r76208
Actually, scratch that - I made those changes in trunk, not the branch. Blegh. Time to merge qged back into trunk - it won't do any harm behind BRLCAD_ENABLE_QT, and it'll save these merge issues...
@Sadeep Darshana OK. If you check out the latest trunk, and configure with -DBRLCAD_ENABLE_QT=ON you should get qged to build. If you're still having problems I'll go another round with it, but we should be closing in.
The old Qt libdm/fb code was never working properly from what I can tell, and anyway it was an attempt to hybridize Tk and Qt which is definitely not what we want for this. There may be a couple useful bits in there somewhere, but I wouldn't worry too much about trying to work with it - a clean Qt only start would probably be more effective.
I built qged in the trunk on windows
@starseeker I'm adding the dm to qged. No major changes to the project. You should be able to replace easily later once you decide to work on the dm.
@Sadeep Darshana excellent!
It should be working but some weird bugs came up. Something related to lists I guess. I'll fix this and let you know.
Hmm... initialization failure. It may be that qged isn't doing an initialization step your stand-alone app did?
you mean BU_LIST_INIT(&vhead); right?
that's the low level error - it cropped up in rt_arb_plot, which is presumably trying to write out its data to a plotting list. There are some global initialization that need to happen for that to work IIRC, but qged wouldn't have done any of them since it wasn't drawing anything
Although if you're using a local vlist that should avoid the globals... hmm
@Sadeep Darshana where's your code located?
Just my computer. I'm working on a the main repo, trunk, qged folder.
Ah, OK. Was going to take a look, but that's not practical :-)
Is there an area I should look into?
is this global initialization thing not necessary for local lists?
Worst case, follow a draw command from mged through libged to librt and see how the variables it uses are initialized. That's probably a bit extreme, but it'll work as a fallback
bn_vlblock might be relevant here, actually.
I did just that. I compared how the same plot method works is my project vs my slightly changed implementation in qged. It crashes only in qged. However I couldn't go beyond arb8::rt_arb_plot::1185 since rest of it goes through C macros and not normal function calls.
I'll fix this and let you know. Just tell me if any global level initialization are necessary before using lists other than (BU_LIST_INIT(&vhead)).
src/util/plot3-dm.c might be helpful
@Sadeep Darshana if you can commit your code anywhere, I might be able to help a bit more... the drawing code is a bit obtuse, if I can get gdb on it that would be better...
BU_LIST_INIT(&RTG.rtg_vlfree);
the above might be worth a shot - found a note about that in some similar code
specifically mentions the ft_plot() functions, in fact
Or it looks like you can call rt_vlblock_init and get back a struct bn_vlblock from RTG.
@Sadeep Darshana Maybe something like:
struct bn_vlblock *vbp = rt_vlblock_init();
ip->idb_meth->ft_plot(vbp, ip, tsp->ts_ttol, tsp->ts_tol, 0)
thanks, I'll try them
starseeker said:
BU_LIST_INIT(&RTG.rtg_vlfree);
the above might be worth a shot - found a note about that in some similar code
Apparently this fixed it.
There is a global initializer before using lists. Who'd have thought that
Well, drawing lists specifically. RTG is one of those warts we eventually want to get rid of, but it'll be a job to get it out. Lot of API will have to change to no longer assume a global.
added the DM to qged dm.gif
That's AWESOME!!
Indeed, way cool @Sadeep Darshana -- What's something like havoc.g look like?
Sadeep Darshana said:
There is a global initializer before using lists. Who'd have thought that
Yeah, it's nutters. It was done for not insignificant performance reasons. Reasons unlikely as important today as they were years ago, but probably still giving a boost on big models. A bit of work to fix it.
Sean said:
What's something like havoc.g look like?
I had the desired top object name hard coded into the dm in both cases since it has not been implemented to cooperate with the tree view
@Sadeep Darshana can we get the code anywhere to try it ourselves?
shall I upload it to github?
or I can send you the svn diff files? @starseeker
Either way - whatever's easier
an svn diff I should be able to apply to trunk as a patch, which would make it easier to commit
@Sadeep Darshana if the qged code is significantly different from the coreInterface code, an svn patch probably makes the most sense - for coreInterface git would be better
hey @starseeker just give me an hour, Im making some changes to make the code look more consistent with the current existing codes
@Sadeep Darshana sounds good!
I'm using glm for camera. If we actually decide to go with my implementation, glm should ideally be place in src/other/. I'm placing it under qged directory for the moment.
@Sadeep Darshana that should be fine
qged_display_manager_patch_r76220.patch
I had to make some changes
the patch is big because of glm
@starseeker let me know if you plan to integrate this into qged. I was using qtNaming.
@Sadeep Darshana I'm trying it on Linux now - the code is tripping a few GCC warnings.
What I would suggest, if it's OK with you, is for me to get it building here, I'll commit it to trunk (crediting you in the commit message), and then have you make another pass to produce a second patch to fix any Windows issues I might have inadvertently introduced while working on it with Linux.
I'll strip glm down somewhat - we'll only need the headers themselves and the license/readme files, we can skip the tests and such.
@Sadeep Darshana What database should I open to test this? I got it to compile, and it opens a .g file and displays the axis, but it doesn't seem to draw the wireframes (or do I need to zoom to see them?)
starseeker said:
What I would suggest, if it's OK with you, is for me to get it building here, I'll commit it to trunk (crediting you in the commit message), and then have you make another pass to produce a second patch to fix any Windows issues I might have inadvertently introduced while working on it with Linux.
This is great
starseeker said:
Sadeep Darshana What database should I open to test this? I got it to compile, and it opens a .g file and displays the axis, but it doesn't seem to draw the wireframes (or do I need to zoom to see them?)
Did you zoom out and see? It does not have autoview yet.
You can use the controls in Display.h. For zooming its mouse wheel.
goliath.g works without zooming
Huh. Odd. The axis draw, but none of the object wireframes do. @Sadeep Darshana I'll commit the current state to trunk - can you check whether, it works for you? I've tried to be minimal about the changes I've made - some of them have to be considered temporary, in fact - but I don't think I changed any of the significant logic...
sounds good
Let me know when I can get it on the trunk. Also do you think it is better if I change the naming convention to qged?
It'll be in a few minutes - trying to commit now
Not too worried about naming right now - functionality is most critical
also what is your environment?
Ubuntu linux, gcc compiling
It's committed to trunk now - r76234
@Sadeep Darshana I've had decent luck setting up virtual machines with VirtualBox, if you want to give that a go and have the hard disk space for it...
I have ubuntu installed in the machine. I will download qt and setup.
@Sadeep Darshana Sounds good. It's presumably something small, since the axis draw and zoom works (If I zoom out far enough the axis will shrink and vanish)
I stepped through a debugger once and it did seem to be walking the tree and calling drawSolid, but I didn't get deeper than that.
I'm installing a VM since it is easier than switching OSes. Trunk's working fine in my windows machine. One distinction between axes and the wireframes is that axes are rendered with GL_LIGHTING off while the other with light.
Removing GL_LIGHTING doesn't change anything here, as far as I can tell.
l.png Can you tell me more about your setup? @starseeker
Trunk/qged on Ubuntu 20.04 on Virtual Box, Qt 5.14.2
GPU? Qt version, Ubuntu version?
I'll setup everything as similar to you and test
Weird. Maybe it's the NVIDIA GPU drivers.
Let me try in a VM myself - if it works there then it's my setup here.
Qt is version 5.12.8, same Ubuntu version
I implemented a not-well-optimized immediate mode (no display lists). Will send you a patch. Axes don't use display lists.
before that let me try on nvidia, i was trying on intel graphics
it works on nvidia graphics, windows
I did not try Ubuntu+nvidia combination, will try that.
Feel free to implement a new DM if you are planning :smiley:
Heh.
@Sadeep Darshana I'd probably be looking at something like https://github.com/Pseudomanifold/QtOSG
Which is probably a different rabbit hole altogether
Sadeep Darshana said:
Feel free to implement a new DM if you are planning :smiley:
What do you guys mean by DM?
display manger, the whole thing about dispalying stuff
a backend implementation of the primitive graphical drawing operations
ooh
Display list generation happens inside a SLOT. could this be the case?
Not sure - that's the problem with these sorts of failures, so many issues have the same symptom (drawing failure)
And it's even worse when it happens sometimes but not always
This is a patch on top of current revision. Can you apply that and see if it fixes?
Get a wireframe now, all red
that is expected
also change GeometryRenderer::immediateMode and see what happens?
you are using qt, right?
Yes
change it in display/GeometryRenderer.h?
yes
in the header
Still works, same result
wow
Feels a bit faster
GeometryRenderer.cpp uncomment line 45 and see, //glEnable(GL_LIGHTING);
starseeker said:
Feels a bit faster
this is with display lists
Now works with color
problem was with SLOTS
Do you want me to commit the change?
yes
coming up
where is the code hosted?
@Sumagna Das it's in the main brlcad svn repository - you enable it with -DBRLCAD_ENABLE_QT=ON
apparently we can't call opengl methods inside SLOTS, even if we call makeCurrent()
Ah. Yeah, OpenGL isn't good at multithreading - IIRC it was one of the motivations for Vulkan
mmm.
starseeker said:
Sumagna Das it's in the main brlcad svn repository - you enable it with -DBRLCAD_ENABLE_QT=ON
you mean if i add the option then the older gui will not be available or will the qt one be there along with the older one?
let me know when you've committed, the immediate mode is not optimized. It ft_plots every frame
no @Sumagna Das you have to build the target qged
you can build it only if -DBRLCAD_ENABLE_QT=ON
ohh
qged is a seperate project from archer or mged
@Sadeep Darshana committed - I left the immediate mode off and the lighting on, let me know if you want that changed
that's how it should be
what needs to be changed now? maybe the camera has to be changed to something standard. I just coded the thing up.
@starseeker do you have -Werror off somehow, I couldn't build it with gcc because child() is deprecated if (cnt && !idx.child(cnt-1, 0).isValid()) {
(cadattributes.cpp:249)
had to change the lines
@Sadeep Darshana Probably a different compiler version. What did you change it to? If you want to send me a patch I can commit it and credit you
I just set the whole thing to false :sweat_smile:
@Sadeep Darshana The next things that jump immediately to mind are:
translate the old ogre/qt gui Camera implementation into something we can apply to this widget (that will let users switch between different camera modes easily, sort of like how freecad works)
get autoview to work
Enable the "draw" and "erase" commands
@Sadeep Darshana Looks like the problem is this issue: https://doc.qt.io/qt-5/qmodelindex-obsolete.html
I'll look at the ogre camera thing. We'll have to reimplement the logic, don't we? It's not like we can use ogre (same thing as https://www.ogre3d.org/ ??)
@Sadeep Darshana I'll comment out for now, don't have time to dig into what we were doing there and why right now
@Sadeep Darshana Correct. The trick is to extract the camera behaviors and translate them to what is needed for your widget
no need, I'm using windows. I only needed to compile in gcc to look into the issue.
Yes, many years ago there was an attempt to display Qt inside Ogre. We ended up going a different direction, but there was some nice work done to implement camera controls - we're hoping it can be used to guide a new implementation (small pieces may even be reusable, not sure)
I will look into this
Since it's based on the Ogre camera that part obviously won't be usable, but the methods implemented will define behaviors - those are what we want to capture in the new setup
For example, https://sourceforge.net/p/brlcad/code/HEAD/tree/rt%5E3/trunk/src/g3d/CameraModeBlender.cxx has an injectKeyPressed method that identifies what to do with the -, +, Enter, etc. keys as far as manipulating the scene. We have no Ogre camera to control, but the Qt widget you've created can execute its equivalent operations in response to those same Qt actions.
Eventually I'd like to have a toolbar control in one of the panels on the right that lets the user toggle between camera modes as an option, but first we need the camera controls themselves :-)
I looked into these codes and tried to understand them earlier
In the longer term it would also be nice to allow the user to define their own custom bindings (the way games do) to be saved and reloaded as their personal configuration. That's a more complex GUI and not worth trying right now, but I mention it as something to keep in mind when designing the implementation - allowing for pre-backed binding configurations and (eventually) custom configurations defined by users as well.
If you feel it would be better to start from scratch that's fine - the key is to capture the behaviors
it is better to implement the logic in those cameras
Sounds good
One additional quirk - if you drag the display window out of the main application (i.e. turn it into a floating window) the geometry disappears
I can create an animation to demonstrate if that would be helpful
lemme check
I could reproduce this.
are we planning to support multiple docs?
Well, multiple views. If you run Archer you'll see an option for Multiview in one of the menus, for example
In MGED you can "attach" multiple display windows
is that many views (top, front, I have seen this in 3dmax) for the same database or multiple databases?
many views for the same database (at least for now)
We've got some work on the backend to do before we're really ready for multiple databases open at once - it's done in a few cases, but things like that librt global variable make it a tricky business.
starseeker said:
One additional quirk - if you drag the display window out of the main application (i.e. turn it into a floating window) the geometry disappears
My first impression for this was due to the Display instance being destroyed and a new instance takes its place. But this is not the case I just debugged, it is the same. Apperently OpenGL context resets (displaylists are saved when db open)
I'll fix this and post a patch
I fixed this bug. Now there is another bug. When I dock the window back, sometimes it displays full black until the next paintGL event. (which happens when you click mouse inside the display / resize the screen / minimise / maximize).
I'll fix this and post both in a patch
bug_fix.patch
Fixes the first bug. Pls check if it works and merge. Have to look at ads to fix the next
@starseeker fwiw the -Werror thing also exists in cadtreemodel.cpp:803 (idx.child) same line as cadattributes.cpp which you have fixed and committed.
Well, commented out and committed - need to check what the original intent was.
bug_fix.patch is committed
commented out the second one as well
can you commit the other files in the patch too :slight_smile:
They didn't look like they'd changed other than the timestamp - are you using that to keep track of what's changed?
Oh, nevermind - removed it. My bad.
One sec...
Heh, sorry - there we go
thanks
Nice work, by the way - that detachable feature is going to make a very cool demo video once you're done!
ah
If we end up using the advanced docking system long term, there are a couple things I'd like to try to get it to do it doesn't right now, but on the whole it looks like a significant improvement over the old Qt-included version.
@Sadeep Darshana any thoughts on how we might do a "HUD" visual (heads-up display) in the Qt window? In MGED and Archer these would be the faceplate elements and the embedded framebuffer.
(No problem if you've not considered such issues yet - seeing qged with a wireframe visualization is exciting, and gets me thinking about possibilities...)
you mean for things like scale, and viewing parameters?
@Sadeep Darshana the embedded framebuffer (at least as currently implemented) doesn't scale - it's just invalidated and needs to be re-rendered if the view changes in any way. I was thinking more about how to present the rendered image in the dm window, the way we do in Archer via the toolbar buttons.
Nevermind, more important right now to get the current pieces working.
@Sadeep Darshana If you're having to delve deep into the qtads code, there are a couple improvements that it might make sense to make at the same time you're chasing down that black-window-on-redocking issue. If you're interested let me know and I can explain in more detail.
@Sadeep Darshana here's a page showing a screenshot of the input controls I mentioned: https://brlcad.org/wiki/User:Ralith
Last updated: Jan 09 2025 at 00:46 UTC