Main Menu

Cpct?

Started by AGP, September 16, 2019, 06:45:59 PM

Previous topic - Next topic

EgonOlsen

Ok. Have you tried to output everything that goes into that method? Maybe something other is null than the indices themselves.

AGP

Yeah, I added a try-catch to the entire method. It gets me through initialization, then it stops happening. Still, I'm not getting anything drawn when compiling the objects.

AGP

On occasions whose particularities I've yet to identify, I can't get rid of the following message.

Quote
WARNING: World.renderScene(): There's a problem with the object list not being consistent during rendering. This is often caused by concurrent modification of BR3D objects on a thread different from the rendering thread! Is camera null? False Is visList? False

Also, only the Skybox renders when compiled...

EgonOlsen

That message is printed out in the assumption that a null pointer is mainly caused by the situation mentioned in the message. I don't think that this applies here. Just check what the actual exception is (my code should log it afterwards, I don't know what your port does) or at least, in which line is happens. Still, there's something fishy with the way in which is setup things. There should be no need to catch some exceptions that happen during init. It doesn't really help, it just postpones the problem.

AGP

#139
The NullPointerException only says, "Object reference not set to an instance of an object." Very useful, so I printed both the stack and the following messages:
Quote
NullReference:    at Object3D.render(Boolean software, Single mx, Single my, Single scalex, Single scaley, Single divx, Single divy, Boolean mayOptimize, Int32 tc, FrameBuffer buffer)
   at WorldProcessor.processInternal(FrameBuffer buffer, List`1 objectList, Portals portals, Camera camera, Boolean software, Single mx, Single my, Boolean mayOptimize, Boolean hasToSort, Int32 start, Int32 end, Single camScaleX, Single camScaleY, Boolean gl)
   at WorldProcessor.process(FrameBuffer buffer, List`1 objectList, Portals portals, Camera camera, Boolean software, Single mx, Single my, Boolean mayOptimize, Boolean hasToSort, Int32 start, Int32 end, Single camScaleX, Single camScaleY, Boolean gl)
   at World.renderScene(FrameBuffer buffer)
Object3D.render(): compiled. Is visList null? False
Object3D.render(): compiled. Is visList null? False
[ 8/4/2021 3:25:24 AM ] - WARNING: World.renderScene(): There's a problem with the object list not being consistent during rendering. This is often caused by concurrent modification of BR3D objects on a thread different from the rendering thread! Is camera null? False Is visList? False

EgonOlsen

No line number of any kind?

AGP

It's compiled code, man, it's not a bytecode. No line numbers in C# stack traces.

EgonOlsen

C# compiles into CIL, which is bytecode as well. It's very similar to what Java does, hence the similar performance characteristics. It should be possible for it to print out a line number. With this error message alone, it's almost impossible to find out, what is null here. Maybe you can configure the compiler to include line numbers? Some debug mode or similar?

AGP

Actually, I knew that. I also now know that the -debug option is not supported on Windows (or at least not Windows x64) for whatever reason. And every solution to line-number printing I find fails (one of them always prints line 0, another doesn't even compile on Mono). Fun.

AGP

#144
See, that's why people should talk to each other. I could have been stuck on this forever if you hadn't mentioned line numbers. By making the debug call "debug:embedded" I got the line numbers in. The problem had been that my Lights class was not initializing the distanceOverride array. Compiled objects are still not rendering, though, so off to find that issue (now aided by the line numbers).

AGP

Update: the line thing (running my game by calling mono before the .exe) sometimes crashes the application and still fails to give you numbers. Here's where I am: I can compile(true) my main character. The Skybox, too, but it becomes semi-transparent. Nearly everything else disappears when compiled. Maybe the Skybox transparency is a hint, but I don't think so because the disappearing objects also don't show up as wireframes. It's as if jpct is either translating them far out of view or otherwise clipping them.

EgonOlsen

Or the rendering itself is faulty. Hard to tell. You can get the returned center of the objects. If that lies within reasonable bounds, the object should be visible. I think there is also a method similar to wasVisibleInLastFrame() or something like this in Object3D that you can call to see if the object was, well, visible (geometry wise, it doesn't mean that it has been rendered).

AGP

I put a WriteLine on the following block inside CompiledInstance.render() and for every model, including the ones that didn't render, I get "...about to render."


                     if (!wireFrame) {
                            if (vertexAlpha) {
                                   // Actually, this doesn't matter but anyway...
                                   cols[3] = 1;
                            }
                            System.Console.WriteLine("CompiledInstance.render(): "+obj.getName() +" about to render.");

AGP

I'm getting, I think, to a crucial place. I believe that it's one of the following three variables. If you have any insight about what might be wrong that around line 544 in CompiledInstance the rendering block never clears the if (!useDL || (listID == 0 && !buffersCreated)) test (and, thus, never renders most objects) I would appreciate it. The following is the state of most every object in this forest scene.


if (useDL || (listID != 0 && buffersCreated))
         System.Console.WriteLine("Not rendering "+obj.getName() +" because useDL: "+useDL +", listID: "+listID +", buffersCreated: "+buffersCreated);

Quote
Not rendering grassB628_jPCT438 because useDL: True, listID: 0, buffersCreated: True

EgonOlsen

That actually doesn't look wrong to me at first glance. Does any object has a listID other than 0? If not, it might help to check where it gets assigned.