Advertisement

multiple definition's

Started by August 13, 2005 06:36 PM
16 comments, last by kc_0045 19 years, 2 months ago
Are you testing a release build (i.e. with optimisations)?

Enigma
Quote: Original post by Enigma
Are you testing a release build (i.e. with optimisations)?

Enigma


Im not sure...im using devc++ and im just pressing compile :P ill check...

Edit: i tryed swicthing the opitions for that around, and got the same thing. didnt seem to change much
Advertisement
There is no release version in dev-cpp, however you can turn on optimization in the project setup. (project setup->complier->optimization)
But I am sure that will not solve your problem. Maybe you should post your full project's sources.
well here it is...

kc.mindcasterstudios.com/files/picloop1.zip
In NeHeGL.cpp you have the following loop:
if (PeekMessage (&msg, window.hWnd, 0, 0, PM_REMOVE) != 0){	// Check For WM_QUIT Message	if (msg.message != WM_QUIT)						// Is The Message A WM_QUIT Message?	{		DispatchMessage (&msg);						// If Not, Dispatch The Message	}	else											// Otherwise (If Message Is WM_QUIT)	{		isMessagePumpActive = FALSE;				// Terminate The Message Pump	}}/* this is your problem */else												// If There Are No Messages{	if (window.isVisible == FALSE)					// If Window Is Not Visible	{		WaitMessage ();								// Application Is Minimized Wait For A Message	}	else											// If Window Is Visible	{		// Process Application Loop		tickCount = GetTickCount ();				// Get The Tick Count		Update (tickCount - window.lastTickCount);	// Update The Counter		Draw (tickCount - window.lastTickCount);	// Draw Our Scene		window.lastTickCount = tickCount;			// Set Last Count To Current Count                GetFPS(&window);		SwapBuffers (window.hDC);					// Swap Buffers (Double Buffering)	}}

What this does is checks to see if there is a Windows message waiting. If there is it process the message and repeats the loop. If there is not then it renders a frame and repeats the loop. When you hold down a key Windows will generate multiple messages, so nearly every time round the loop there will be a message waiting and the code will process the message and not render a frame. Remove the else I indicated and the code will process keys and render frames, not do one to the exclusion of the other.

Enigma
Quote: Original post by Enigma
In NeHeGL.cpp you have the following loop:
*** Source Snippet Removed ***
What this does is checks to see if there is a Windows message waiting. If there is it process the message and repeats the loop. If there is not then it renders a frame and repeats the loop. When you hold down a key Windows will generate multiple messages, so nearly every time round the loop there will be a message waiting and the code will process the message and not render a frame. Remove the else I indicated and the code will process keys and render frames, not do one to the exclusion of the other.

Enigma


Idk...i tryed removing it and it still laged(note, also if I remove the keycheck to see if space is pressed, it still laggys, so i dont think it has anything to do with the keyboard stuff...
Advertisement
OK, I tried actually compiling the code. While what I said before was true and would affect the speed of your program the actual problem is that you call ProgramStart() every frame and therefore add a particle to the particle system every frame. Your particle system therefore soon has thousands of particles in it and this obviously reduces your frame rate quite dramatically!

Enigma
Quote: Original post by Enigma
OK, I tried actually compiling the code. While what I said before was true and would affect the speed of your program the actual problem is that you call ProgramStart() every frame and therefore add a particle to the particle system every frame. Your particle system therefore soon has thousands of particles in it and this obviously reduces your frame rate quite dramatically!

Enigma


Hahaha opps :D Thanks alot that fixed the problem...god im dumm :D

This topic is closed to new replies.

Advertisement