Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

skow

A weird problem with blended lines

This topic is 5276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having this problem on a project I'm working on. I'm using anti-alised lines, so blending is required for the lines to work. The lines arnt drawing untill i leave the mose over an object and send a status bar message. This is only happening when I have blending enabled for the lines, otherwise they are drawing fine. Has any one heard of some win32 stuff causing problems with blended GL_LINES? This really has me puzzled. EDIT: Quads, triangles, etc work, it's just lines. [edited by - skow on June 3, 2004 8:05:24 PM]

Share this post


Link to post
Share on other sites
Advertisement
Wow, some one explain this one. It was because in the init funtion, the string that I would pass wasn''t initally set to a value. Once it got a value the lines work, this is the std::string. Very werid.

Share this post


Link to post
Share on other sites
I suspect you are using an uninitialised variable somewhere. That or you have memory corruption. Can you post code, or is the project too big? Best to find the source of this bug now if it is an uninitialised variable or memory corruption, otherwise it''s liable to pop up again later on, when you''re project is twice as big.

Enigma

Share this post


Link to post
Share on other sites
Hey, thanks for the responce. It already did show up again, when a paticular int was above 0, lines would change color/disapear depending on the value.

The project is far to large to post the code. You said memory corruption could be a problem. I''m not sure what you mean with that, if its related to the program how would I go about tracking it down?

Share this post


Link to post
Share on other sites
Memory corruption occurs as a result of buffer under/overflows or writing to bad pointers. Basically it means you''re writing to an area of memory that you shouldn''t be. It can be very difficult to track down. A good debugger will help you, but I don''t know of any easy way to find the source of the problem otherwise, especially when the project is already so big.

If you don''t have a debugger then try reducing your program to a minium and make it output pointer and array index values at every step. Gradually add code back into the project once you are sure there are no problems with the part that you are testing. Alternatively retrofit your code with checked pointers and arrays (this can take a very long time to do) which will alert you to a bad pointer access or array index out of bounds error.

The best way to avoid making such errors in the first place is to change your programming style. Use references where ever possible instead of pointers and use std::deque or another checked container class instead of raw arrays. 99% of the time standard containers will be more than fast enough (they can even be faster than raw arrays) and for the cases where they aren''t you can go back and change them when you''re sure that everything is working properly.

Enigma

Share this post


Link to post
Share on other sites
I use a very limited amount of pointers, mostly the std classes. I''ll check out all the pointers, and make sure everything is declared.

Thanks for the responce.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!