Main Menu

Cpct?

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

Previous topic - Next topic

EgonOlsen

It's curPos. The normal rendering mode (i.e. not for compiled objects) fill a given vertex array from 0 to <some vertex count> and renders that in one batch. How much it fills, depends on the object. If the object is uniformly textured (i.e. it uses the same texture(s) for each polygon), this value should be somewhere near the maximum size of that vertex array.

Have you tried what happens if you disable vertex arrays in the config? If that still renders junk, your problem isn't in the rendering but somewhere before.

AGP

It renders junk with vertex arrays, and it renders nothing if glVertexArrays is set to false.

EgonOlsen

It really looks like as if your geometry is wrong in the first place. Either that, or the conversion into GL format is faulty. In that case, it should at least render fine when using the software renderer. Does it?

AGP

Yes, I had to do that lighting hack on the 1.31 port (one or two of the light multipliers were always 0) but otherwise the SoftGLRenderer renders perfectly. And as I said, the current model being tested is from Primitives.

EgonOlsen

I'm sure the model is fine, if it renders in software. But maybe your conversion into GL coordinate system is buggy?

AGP

The reason that I don't think that that's it, other than the fact that I didn't change what you did, is that no matter what model I test this is what I get:
https://www.youtube.com/watch?v=Pfuo77vKUbo

EgonOlsen

No, that doesn't look like a problem in the model's setup...at least not as the sole reason of the problem. But it's actually impossible to tell what's going on there. Maybe some other GL setup going wrong, but it will be quite hard to find out. I would add a log output to every GL call in the Java version and then compare the trace that this produces with the same thing taken from the C# version while rendering the exact same scene. And then see, if there is a difference between the calls that these versions do. It will be quite a lot of work, I suppose, but you need some kind of reference to track this down and currently, you have none.

AGP

#112
The GLRenderer (not yet the AWT) is working! Yay.

EgonOlsen

Good to hear that!

AGP

My big stress test case is only clearing the screen. The same forest model renders on a model tester if and only if glVertexArrays is set to false. On the stress test, with a player, two skyboxes and some NPCs even without vertex arrays nothing gets drawn. But wireframe always works, on both the loader and the stress test, whether or not vertex arrays are being used. I'm not sure how helpful the following printout will be, but I feel like renderVertexArray(int) should be printing contiguous numbers.


renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 51
renderVertexArray(int): 30
renderVertexArray(int): 120
renderVertexArray(int): 18
renderVertexArray(int): 120
renderVertexArray(int): 12
renderVertexArray(int): 120
renderVertexArray(int): 12
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 15
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 3
renderVertexArray(int): 435
renderVertexArray(int): 51
renderVertexArray(int): 48
renderVertexArray(int): 3
renderVertexArray(int): 12
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 30
renderVertexArray(int): 3
renderVertexArray(int): 159
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 3
renderVertexArray(int): 18
renderVertexArray(int): 3
renderVertexArray(int): 279
renderVertexArray(int): 18
renderVertexArray(int): 24
renderVertexArray(int): 12
renderVertexArray(int): 18
renderVertexArray(int): 3
renderVertexArray(int): 36
renderVertexArray(int): 18
renderVertexArray(int): 36
renderVertexArray(int): 18
renderVertexArray(int): 24
renderVertexArray(int): 81
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 15
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 12
renderVertexArray(int): 12
renderVertexArray(int): 18
renderVertexArray(int): 225
renderVertexArray(int): 3
renderVertexArray(int): 186
renderVertexArray(int): 3
renderVertexArray(int): 12
renderVertexArray(int): 6
renderVertexArray(int): 69
renderVertexArray(int): 168
renderVertexArray(int): 18
renderVertexArray(int): 444
renderVertexArray(int): 6
renderVertexArray(int): 15
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 36
renderVertexArray(int): 240
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 12
renderVertexArray(int): 456
renderVertexArray(int): 21

EgonOlsen

I'm not sure what this number represents, but if it's the size, it might not be unreasonable, if you have many smaller models and/or smaller parts of the model that are using different textures.

AGP

But what does it tell you that when this complex forest model gets drawn it is only when vertex arrays are disabled? Also, why do wireframes always work?

EgonOlsen

Most likely that something is wrong with your vertex array setup and/or rendering code. Wireframe rendering are just simple call to glVertex3f, which draw one line at a time. Everything else is more complex, so there is an increased chance of getting it wrong at some stage.

AGP

But is it possible to have a mistake in the code and still have it sometimes work (a single bush from that forest will render without hitch with vertex arrays)?

EgonOlsen

Yes. OpenGL is a state machine. Maybe the state is correct for this one bush and gets screwed up afterwards.