void update_entity()
{
glLoadIdentity();
glTranslatef(1.0f,0.0f,-6.0f);
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glEnd();
}
🔒 Locked
Slowdown after program ends
Advertisement
Original Post
Hello everyone. Im calling a function from a DLL in an assembly program. When the program ends, everything becomes really slow, and I have to restart my computer (I''ve tried using things like rambooster but it doesnt help). Ive found out that the fucntion im calling that causes the slowdown is this:
The lines that cause the slowdown are the glVertex3f(...)''s (If I comment them out it runs fine). So im not sure why it slows the computer down after the program has ended. My specs are:
Win 98
64MB RAM
Celron 400MHz
8MB ATI Rage Pro Turbo
Any ideas? Thanks.
http://www.labino.net
Well, I don''t know why that function would cause a slow down, but the common reason for slow downs that happen after the application has ended is a memory leak.
To check, try running the resource meter - when the app starts, the ammount of free memory should go down - if it stays down after you quit the app, then you''ve got a leak.
And make sure that you''re freeing the DLL properly.
John B
To check, try running the resource meter - when the app starts, the ammount of free memory should go down - if it stays down after you quit the app, then you''ve got a leak.
And make sure that you''re freeing the DLL properly.
John B
Weird. How did you find out that update_entity was the problem??
There''s another possibility - an infinite loop could cause a major slowdown.
John B
There''s another possibility - an infinite loop could cause a major slowdown.
John B
I just kept commenting everything out of the assembly file, until that was about all that was left, and found out it was causeing the slowdown. Also, It used to be in an infinet loop, but just to test it, I took out the loop, so it just calls it once, then program ends, and it still has the slowdown.
http://www.labino.net
http://www.labino.net
Well, I honestly don''t see how that function on its own would cause a slowdown. I would suggest you post more of your code, but I don''t know which bit to ask for. Oh well - post some more code anyway.
John B
John B
I assume you''ve done this already, but just to be sure, leave everything in, then run it (make sure the slow down is still there), then comment out only calls to that function, and run it again - if that gets rid of the slowdown, then I have no idea what''s going on - if that doesn''t get rid of the slowdown, then I still don''t know what''s going on, but we''ll have got more information, which could be useful.
John B
John B
Sure, heres some code from the assembly file:
Now, if I run that with the 3 lines that I mentioned in my first post commented out, then it works fine, but if I run it with the 3 lines uncommented, then it causes the slowdown.
http://www.labino.net
push dword 0
push dword 32
push dword 480
push dword 640
push dword c_i_WindowTitle ;defined earlier
call [CreateGLWindow]
;its just nehe''s createGLwindow function
mov dword [entity_render], 0
renderloop0:
call [update_entity] ;here it is
inc dword [entity_render]
mov dword eax,[entity_render]
cmp dword 2, eax ;render two ''objects''
jne renderloop0
Now, if I run that with the 3 lines that I mentioned in my first post commented out, then it works fine, but if I run it with the 3 lines uncommented, then it causes the slowdown.
http://www.labino.net
Sorry - I''d better leave you to the experts now, since I don''t know very much about OpenGL or Assembly.
John B
John B
I must confess that my assembler is a tad rusty, but looking at the code snippet, I am a little confused over the render loop.
After initialising the OpenGL window you have the following code
mov dword [entity_render], 0
renderloop0:
call [update_entity]
inc dword [entity_render]
mov dword eax,[entity_render]
cmp dword 2, eax ;render two ''objects''
jne renderloop0
I assume that this code is called each frame in order to render ''entity''. I was wondering where you actually enter this loop each frame. If it is before the initialisation of the OpenGL window then you will be initialising every frame.
If each frame, however, you jump to ''renderloop0'', then you are not reseting the [entity_render] value to 0, thus after the first loop, it will already be set to 2. You then increment and compare with 2, looping of not equal. You would have to count all the way round to 2 again. Thats a lot of entities being rendered !
Now, exactly why either of these problems would cause the problem you are describing, I''m not sure, but they could be cause (but I have made a few assumptions which of course may also be wrong)
Stephen
After initialising the OpenGL window you have the following code
mov dword [entity_render], 0
renderloop0:
call [update_entity]
inc dword [entity_render]
mov dword eax,[entity_render]
cmp dword 2, eax ;render two ''objects''
jne renderloop0
I assume that this code is called each frame in order to render ''entity''. I was wondering where you actually enter this loop each frame. If it is before the initialisation of the OpenGL window then you will be initialising every frame.
If each frame, however, you jump to ''renderloop0'', then you are not reseting the [entity_render] value to 0, thus after the first loop, it will already be set to 2. You then increment and compare with 2, looping of not equal. You would have to count all the way round to 2 again. Thats a lot of entities being rendered !
Now, exactly why either of these problems would cause the problem you are describing, I''m not sure, but they could be cause (but I have made a few assumptions which of course may also be wrong)
Stephen
Basiclly, what is happening is, ever loop it resets ''entity_render'' to 0, then, until entity render equals 2, it will render a certain entity (triangle in this case). Meaning that it will only render 2 triangles each frame. All this code is after the openGL window has been created, and right after that loop it wil swap the buffers and then prepare for another render loop. Anyways, the funny thing is, it works fine on a different computer (win98 SE, 64MB RAM, 64MB GeForce2MX), so im wondering if it may be the video card that causes the problem, as old ATI cards dont have much openGL support...although I dont see why this would cause a huge slowdown after the program is finished. Thanks
http://www.labino.net
http://www.labino.net
ATi Cards are known to have issues with OpenGL
Update ur drivers, the code looks good, try running it on a friends machine (with an *nVidia* card)and see if it still happens
Update ur drivers, the code looks good, try running it on a friends machine (with an *nVidia* card)and see if it still happens
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement