News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

OpenGL backend compatibility issues

Started by Ters, April 07, 2013, 09:58:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ters

When using the OpenGL backend for one of my crazy experiments, I noticed that it crashes the OpenGL implementation for my Intel HD Graphics 4000, which is used by default for Simutrans. If I force Simutrans to use the Nvidia graphics processor, it doesn't crash. This only happens when PBO is used, which probably will be the case on any non-ancient graphics adapter. If I force pbo_able to false, the contents of the Simutrans window is just black. I haven't yet found out whether the fault lies in the OpenGL backend or in Intel's driver, but it certainly proves that the OpenGL backend isn't a safer alternative to pure 2D SDL, despite positive feedback from Mac users.

What I have found out is that the crash occurs when pbo_map calls glTexImage2D. This happens on the first call to pbo_map. If I replace glTexImage2D with glTexSubImage2D, the first call to pbo_map doesn't crash, but it crashes on the second instead.

Update:
Since the current OpenGL backend has three code paths, I reverted to the first edition of the OpenGL backend, which is simpler. Since it doesn't support PBO, it expectedly doesn't crash, but it does not display the black window bug either. This unfortunately might mean that some change related to PBO support also affect the non-PBO code path.

Update 2:
I can't reproduce the black window bug anymore. The only thing I did was switch to testing on a working directory without my experiment. Simutrans still crashes when using PBO-mode.

Markohs

#1
I only have available a nvidia and a ati card, having it a look anyway,   there has to be a programming error somewere for sure. I foud useful having breakpoints in the gl_error debug function to try to locate what was accepted and not by OpenGL

abot the pbo that code needs to be fixed and made to work fir sure, because after my current projects in simutrans I had planned a pbo + vbo implementation, that should be very very close or better in performance than current SDL one.

Ters

#2
I've been using glIntercept, which intercepts all OpenGL calls, logs them to a file with all paramters, and which also checks glGetError() and log any errors. But no errors are reported, and in my experience, OpenGL doesn't do much error checking. It seems to be a relic from the time when programmers were trusted to do things right.

Update:
I found that the black window bug is cause by my experiment doing glBindTexture(GL_TEXTURE_2D, 0); at the end of dr_flush(), after all the rendering, but before the buffer swap. This means that no texture is bound when dr_textur() is called and tiling is not on. It's easy to fix, but probably not something that needs to be fixed in trunk for the time being.

Markohs

Oh, I searched for some kind of degug helping to OpenGL in the past and didn't located the glIntercept. Thank you! I'll have it a look.

Good, thank you for your help. I'll have a look to this and improve the backend when I finish all the world limits bugs and improvements. :)

Ters

We'll see. Maybe I'll beat you to it. Though it's far from certain I'm as motivated next weekend.