Page 1 of 1

[fixed]OpenGL- loading 3d model problem

Posted: Thu May 29, 2008 7:55 pm
by qez111
Note : The following bug occurs only in OpenGL Mode. DirectX9 mode works fine.

I have noticed that my program freezes on loading a 3d model. I have checked two formats: 3ds and b3d and in both cases the program simply freezes after it says 'Loaded mesh: 3ds.3ds' (Note: it freezes/hangs. it does not crash.)
I tried to trace the problem and it seems that it has started occurring only in Rev 1329 and later.

To reproduce this bug, you can simply open the MeshViewer (Tutorial 9), and try to load a 3d model in OpenGL Mode. And you will notice that the program will hang/freeze.

Posted: Thu May 29, 2008 10:01 pm
by hybrid
That's definitely not abug visible for everyone - at least I just tried mayn meshes today and had no problems at all.

Posted: Thu May 29, 2008 11:33 pm
by wyrmmage
actually this may be a bug with your display driver (make sure the program is hanging when it's loading the model, not displaying the scene). My laptop hangs for about 25 seconds every time drawing is called (when it's being run in OpenGL...works fine in DirectX >.>); for me, this appears to be a video card driver bug, and updating the driver did not solve it, so at the moment I'm developing using DirectX instead of OpenGL :(

So, ya...that might be relevant :\
-wyrmmage

Posted: Sat May 31, 2008 6:30 pm
by qez111
If it is a bug with my display driver, then I am wondering why it is working perfectly with revisions 1328 and earlier revisions. It loads perfectly with the earlier versions. Why only after Rev1329 this problem is occurring? And it is freezing for indefinite time. I tried waiting for over 20 minutes but still the mesh viewer (and my program as well) is frozen.
I tried on three different systems, but this problem is there on all of them. But yes, all of them are using ATI Radeon cards. But I couldn't possibly think it is a bug with the graphics card, because of the fact that the mesh viewer (and my program as well) works properly (i.e. in OpenGL mode) when compiled with rev 1328 and earlier.

Posted: Sat May 31, 2008 6:37 pm
by Dorth
if you have a non pow 2 texture, in most recent OpenGL build (no idea at all when it started) and a pretty old video card or old drivers, the app can take incredibly long time to process the texture. I have no idea what is your setting, but when doing a draw2dimage, with aforementioned conditions, it would take my old system from 30 to 60+ ms per image drawn, stalling at the rectangle creation. Thus, if your model is getting created, it might be that each and every triangle strip takes that huge amounts of time. Try drawing your model's texture with draw2dimage if you think that might be the case. If it lags like... you'll know what to follow. If not, well, gl ;)

Posted: Sat May 31, 2008 8:02 pm
by wyrmmage
The graphics card that had the problem for me was an ATI Radeon Express 1100 (it's a laptop card), so the problems very well may be related.

Dorth, I just realized that some of my textures are non-power of two textures, so I'm definitely going to resize them and see if that fixes the problem...thanks for the heads up! :)

*UPDATE* just tested it out after resizing all my textures to a power of two, and...it works! Dorth, you rock! ^_^
-wyrmmage

Posted: Mon Jun 02, 2008 3:33 pm
by Dorth
Yeah, that's a nasty one... It should definitively be stretched to a pow2 once at load by default if whatever is needed isn't supported. The cost is just too great if not :?

Posted: Mon Jun 02, 2008 3:50 pm
by hybrid
OpenGL doesn't tell when it falls back to SW rendering. So it's impossible to test for such things. However, I've checked NVidia's driver lists and they tell that none of their drivers does fall back to SW rendering for NPOT. either it's supported (and then in HW) or not at all. Don't know for sure for ATI, but it should be similar. The NPOT rendering should be only slightly slower, if at all.

Posted: Mon Jun 02, 2008 5:05 pm
by Dorth
Well, something, somewhere...

Posted: Tue Jun 03, 2008 7:16 am
by qez111
You are right, when I change all textures to make it power of 2 size, it loads!
But I still believe it would be good for the engine to handle the non-power of 2 images. This would make it easier to support the already created projects. which did not have power of 2 images.

Posted: Tue Jun 03, 2008 8:05 am
by hybrid
Well, the only change which could be related to this problem is that I added another check for the OpenGL version. In case this is 2.0 or higher, the NPOT support is enabled, i.e. textures are not resized anymore, but kept in their native sizes. In case ATI really has a problem here it could be that some weird things are going on. Could you please post the console log of your app upon startup?