Jump to content
  • Advertisement
Sign in to follow this  

OpenGL very interesting problem

This topic is 3937 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 have a doubt regarding my program in which open gl window becomes inactive after a certain time the code looks like this float c=0.1; int d=0; do { d++; if(d>100) exit(0); glColor3f(0,1,0); glBegin(GL_LINES); glVertex2d(c,c); glVertex2d(c+1,c+.4); glEnd(); SwapBuffers (hDC); system("dir"); c=c+.1; }while(1) initially lines are made but after some time , the opengl window i suppose becomes inactive window or so ...... actually it stops drawing lines anymore however the dir command executes at command prompt as the command prompt box continues to execute again and again,, but lines are not made what is the fault ???????? thanks in advance the interesting part is this when i debug my program , it does makes lines i.e performs its function completely but when i run it , it does the above problam (drawing lines only for some time) i am using dev c++ thanks in advance

Share this post

Link to post
Share on other sites
Your code is bizarre. Why do you have exit(0) in there?

Anyway, there is nothing wrong with the code as far as I see.
When d=101, the loop is suppose to terminate.
If there is some ill effect for calling system("dir"), I don't know.
Perhaps calling exit(0) is the problem or there is a combination of problems.

PS : if you want to render many lines, use a for loop.

float c=0.1;
int d=0, i;


for(i=0; i<100; i++)

SwapBuffers (hDC);


[Edited by - V-man on January 7, 2008 8:05:21 AM]

Share this post

Link to post
Share on other sites
I think your while loop messed up the window message loop. Try to put your drawing code inside the message loop instead of using your own while loop. This should solve your problem.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!