jogl - OpenGL light flickering when I update its position each frame -


I am learning OpenGL and just starting to come in the light, I enable light and light 0, my surroundings Setting / spreading / specular in default values ​​in my init method, and then each frame I do something like this:

  glMatrixMode (GL_MODELVIEW); GlLoadIdentity (); // Make my 3-person camera conversion and Rotations Glittefowa (GL_Lite 0, GLoposion, {0.1 F, 0.0F, 0.0F});  

(Note that this is a bit wrong, I am writing in Java using my app JOGL, so I live with each line for better readability for C ++ people. L. and GL.)

Then I have to move on to draw my triangle and this way, and in the end I do a glFlush ().

The strange problem is that when I run my application, light flicker. There is no other call for glLightfv in my entire program (as above, as mentioned above, call in my init method, which I have been debug to make sure that it is run only once ). It looks very fast and shows the tearing of the screen. I do not glDisable (GL_LIGHTING) at any point in my visual image; It's not that I think burning objects should be the reason for the flicker.

I also have, for the purpose of debugging, sections of my drawing code have been commented, and nothing seems to break the light - and of course, I wrote all that way anyway And even then the scene was tested before light, so I do not know the reason that it should be wrong.

Actually I know that this is not much, but before that someone else has a problem? Can not I find any simple solution? Please request any additional information that can help you. And in the end if I can not find the answer then I would have to break a test case, where I can post the full rendering code here and show the problem.

But it shows a little bit about what I am talking about, as far as light is sporadic, bright frames are those who like to see it. Whenever I slow it down to 5fps, it's not too much, and mostly just for a short time or shutdown I do not get ...

Thank you!

Ah! I already got the answer ... I have only specified 3 floats for the condition, when it wants to document as 4. Then the fourth number, which will have some effect on the light of light, was being read from some other random area in memory, and certainly there were strange things.

Sorry to waste your time!


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -