Author Topic: There are many ways to go to Rome.  (Read 53418 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #120 on: March 28, 2019, 04:32:45 am »
My dear friend,

It looks very neat indeed and is fun to play with. :-*

But alas, it is very impractical to work with, at least in its present state. :-\

The major problem is that the wireframe/bullet overlay seems to be drawn only once and is then simply zoomed into/out of together with the texture image. This makes it impossible to either clearly see the wireframe or zero in on a bullet and drag it — at any zoom level other than the maximum/deepest one.

This isn't how it should be. A wireframe line should remain exactly one non-AA pixel thick, and a bullet, 3x3 non-AA pixels large, regardless of zoom level. This means the overlay should not be zoomed but rather redrawn each time the zoom depth is changed with the aid of the slider, or the zoom rectangle, dragged in the zoom widget.

The portion of the wireframe image to be drawn in the overlay should be enlarged according to the current zoom depth and clipped to within the zoom rectangle as seen in the zoom widget. This will dramatically reduce the number of wireframe tris and bullets to be drawn at any zoom level other than the full view, and drawing may arguably become significantly faster.

This tactics will enable the user to see, and work with, the UV mesh confidently at any zoom level rather than at the current deepest level only. The user then won't have to lose time adjusting the zoom just to make the wireframe visible, or dive to the deepest zoom to be able to drag one or two bullets around.

Do you think you can re-implement what I'm trying to describe?
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #121 on: March 28, 2019, 10:17:32 am »
I am well aware that it is not practical like this, so far i have been fighting with something else, and now that it has been solved i can move on (as i said it was just a backup for security purpose).

My idea was to work with a delimited section (region of interrest), and/or with a mouse hover to detect the red dots and display a marker that could be moved to change the underlaying UV's coordinate(s)

Using a bitmap with the red dot coordinates is the only pratical way to detect fast, a specific XY location, without scanning everytime a whole array.
The other way would be to save the triangle coordinates, and perform a PtInTriangle detection (working like PtInRect).

I am also trying from my best to reuse the existing Pandora's code to avoid code duplication, and use the existing mechanisms.

Because of the spring work i have to do for the house, my wife is exercing a hard pressure on the time i could spend on programming, thus slowing doing my progress and ruining my concentration  ::)
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #122 on: March 28, 2019, 11:42:49 am »
Thank you for the heads-up on your strategy! I'm looking forward to your progress in that direction. :)

Quote
Because of the spring work i have to do for the house, my wife is exercing a hard pressure on the time i could spend on programming ...

I understand those seasonal/rural factors perfectly well as I used to both have a wife and own a country cottage myself in the past as well. It is only too good you don't have to also plow your land in spring and shovel manure in summer to gather your harvest in autumn. :D

What regards me and my progress, I think we're going to see ObjReader's first practical FBO renders some time this week, most probably this weekend.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #123 on: March 28, 2019, 06:20:19 pm »
Quote
What regards me and my progress, I think we're going to see ObjReader's first practical FBO renders some time this week, most probably this weekend.
Great news my friend!

Do you have a preference using

long dimDot  = (nW * nH) / 8;

between the new
long* Dot = new long[dimDot]; // Delete [] Dot
and the old
long* Dot = (long*) malloc(dimDot); // free(lDot);

to be used with BitSet and BitGet, to easily detect the triangle Dot locations without wasting memory.
BitGet(UsingLongArray(Dot), y * nH + x)

Note: nH is the stride value
« Last Edit: March 28, 2019, 06:28:20 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #124 on: March 28, 2019, 06:50:54 pm »
1. Personally, I'd prefer to see long dimDot  = (nW * nH) >> 3;

2. If the Dot[] array isn't going to use CPP advanced features like quicksort or mapping, then I'd prefer to use long* Dot = (long*) malloc(dimDot); // free(Dot);. Our coding style is procedural ANSI C, not CPP, and it should look like one.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #125 on: March 28, 2019, 06:55:22 pm »
OK, thank you!
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #126 on: March 30, 2019, 11:11:07 pm »
I'm working, I'm working!!! :D
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #127 on: March 31, 2019, 03:06:59 pm »
I finally found what was causing me the array bound error in CreateUVmap

I am using a bit array and a bitmap of the same size than the original texture size (nW = width, nH = height)

then i compute the x,y coordinate like this

x = (long) ((nW - 1) * vertex->texCoord[0]);
y = (long) ((nH - 1) * (1.0f - vertex->texCoord[1]));

to bitset a single bit at location y * nH + x
however both x and y computation could result in a value much larger than the nW width or the nH height.

Thus to protect from array bound error, i have used this

        // Detect unique dot
        if ((x < nW) && (y < nH)) {
            dotXY = y * nH + x;
            if (BitGet(Dot, dotXY) == 0) {
                BitSet(Dot, dotXY);
                ++dotCount; // Unique dot count
            }
        }


Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #128 on: March 31, 2019, 03:31:13 pm »
Thanks for the array bounds fixes! But I do not have any code in my Tor.cpp that would actually use either BitGet() or BitSet(). I've got only their implementations. ::)

Re. FBO, OR doesn't work for me either under my nVidia+W10 or ATi Radeon+W7. :(

I will need more time to check and fix the glitches. (everything's perfectly fine for me under my dev W7  :-\ )
« Last Edit: March 31, 2019, 04:10:01 pm by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #129 on: March 31, 2019, 08:12:38 pm »
I'm trying to isolate the cause of failure. But I'm almost certain it is a driver problem. Are you sure you have the latest driver for your nVidia card?
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #130 on: March 31, 2019, 08:54:34 pm »
I have the latest driver version 419.67 from 03-25-2019.
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #131 on: March 31, 2019, 09:07:13 pm »
Good.

I think it is not the FBO code that causes the failure. When it's removed, OR still tends to crash on my AMD/ATi box... :(

OK that's enough for today; I'm a bit tired...
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #132 on: April 01, 2019, 10:05:01 am »
Most probably the problem is in gl_Init() (PixelFormat ?).
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: There are many ways to go to Rome.
« Reply #133 on: April 01, 2019, 11:03:13 am »
No, my previous build (without the Tor and FBO code) enhanced with the new OpenGL 3.0 GL_ARB_framebuffer_object extension initialization in gl2.cpp and selection of simple pixel format in Mobj_choosePixelFormat() in mobj.h works flawlessly under both W10 and ATi/W7... ???

I need more time to check the code flow historically step by step to spot which mod exactly started to cause the OR crash.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: There are many ways to go to Rome.
« Reply #134 on: April 03, 2019, 06:41:14 pm »
I have been fighting with a difference of behavior between VS2010 and VS2017 in GDimage64.dll, that was causing a problem when using WM_MOVING to move the Splitter.

This was because BitSet and BitGet are not working the same into the two compilers.  >:(

I have replaced the function calls with their define counterparts, and bingo that solve my problem.
#define BitSet(Array, BitPos)   ( Array[(BitPos >> 5)] |= (1 << (BitPos % 32)) )
#define BitReset(Array, BitPos) ( Array[(BitPos >> 5)] &= ~(1 << (BitPos % 32)) )
#define BitGet(Array, BitPos)   ( Array[(BitPos >> 5)] & (1 << (BitPos % 32)) )
Patrice
(Always working with the latest Windows version available...)