glScalef Causing Culling problems....

Started by
3 comments, last by Hamster 20 years, 7 months ago
Hi, I''ve been playing around a little with terrain recently. To try and be fairly memory efficient I''ve been storing my vertices as shorts, which of course leads to impossibly huge vertical terrain when drawn unless glScalef is called. My problem is that this seems to mess up my culling, implemented by means of a quadtree of 3d bounding boxes. By studying the behaviour, it would seem that even though the bounding boxes are drawn correctly to scale when debugging is enabled, it is still trying to cull unscaled versions. In my newbieness I tried to call glScalef on the projection matrix, but that didn''t go down well at all. I''d welcome any suggestions and code can easily be posted if requested, I would have already, but I''m not sure where the problem is and don''t want to bring down the forums with my whole lame engine. Thanks in advance for any help you can give. John
Advertisement
quote:"but I''m not sure where the problem is and don''t want to bring down the forums with my whole lame engine."


heh, that thought crosses every1s minds at least once.
Well, I''m a newbie to OpenGL as well, and i might have a solution on what the problem might be. What if, for some reason, the culling depended also on the normals?(dont know if they DO have something to do, ill just slurp away, XD) Well, if you''re gonna scale down the whole normalized terrain, i suggest u enable GL_NORMALIZE at the beginning of the code.
If it doesn''t werk, then, could you post the source? I''d like to see it, maybe its a convertion thing..or something..dunno... post!
quote:Original post by Hamster
By studying the behaviour, it would seem that even though the bounding boxes are drawn correctly to scale when debugging is enabled, it is still trying to cull unscaled versions.
Well, since you''re doing frustum culling yourself, how is your culling algorithm supposed to know about the call to glScalef()? You need to take the scaling factor into account yourself in your culling algorithm.
also: what do shorts have to do with it? if everything is 10 times bigger, then just move 10 times faster. there is no size or scale except the one you set yourself. there is no difference between 0.0001 and 100 as long as everything is consistent.
f@dzhttp://festini.device-zero.de
Hi,
Thanks for the replies. I suppose shorts don''t really have anything to do with it, but for odd reasons to do with my hackish implementation it''s probably better to scale the terrain down vertically than anything else. Thanks to Myopic Rhino for his suggestion, I''ve attatched the scaling factor to the culling implementation and everything seems to work now.

This topic is closed to new replies.

Advertisement