glVertex2i vs glNormal3i (Bad performance hit)

Started by
7 comments, last by KulSeran 17 years, 5 months ago
Hi, Amongst lots of other code, I've been doing something bog standard such as:

	glBegin(GL_QUADS);
		glVertex2i(0, 0);
		glVertex2i(200, 0);
		glVertex2i(200, 200);
		glVertex2i(0, 200);
	glEnd();

However, this has been giving me a fps of about 5k. Although changing to this:

	glBegin(GL_QUADS);
		glNormal3i(0, 0, 0);
		glNormal3i(200, 0, 0);
		glNormal3i(200, 200, 0);
		glNormal3i(0, 200, 0);
	glEnd();

Has increase performance by about 1.5k fps. I'm not using anything other than textured quads, although this particular quad does not use them. What could cause something like this? Thanks, NB
Advertisement
because your not actually drawing anything maybe? drawing nothing (ie: no vetecies) is less expensive than actually drawing something. just sending normals to the video card should not be that expensive since they are just stored, but no rasterization ever takes place.
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
Quote:Original post by anist
because your not actually drawing anything maybe? drawing nothing (ie: no vetecies) is less expensive than actually drawing something.

nice
also NewBreed using vertexXi or normal i etc is not recommended often u will fall off the fast apth if u use int
stick to floats the only exception are perhaps GLubytes for colors

Hi guys.

Thanks very much for your comments. I've tried switching to glVertex3f and although the fps increases, it's certainly not drastic. What I don't get is, why would draing a quad be so expensive? There's no optimisations in there, but still... it's just a quad.

Thanks for your time.
NB

[Edited by - NewBreed on November 9, 2006 8:21:03 AM]
Who says the performance drop is drastic and just drawing a single quad is expensive? Look at the rendering times; you decrease the framerate from 5000 FPS to 1500 FPS. That means the quad scene takes about 0.47 milliseconds longer per frame to render. That is the same drastic performace drop you have when going from 30 fps to 29.6 fps. Hardly noticable in other words.

You're making linear conclusions out of a nonlinear quantity. FPS is not linear, but rendering time is. That is what you should measure and draw conclusions from.
Quote:Original post by NewBreed
Hi guys.

Thanks very much for your comments. I've tried switching to glVertex3f and although the fps increases, it's certainly not drastic. What I don't get is, why would draing a quad be so expensive? There's no optimisations in there, but still... it's just a quad.

Thanks for your time.
NB


With glVertex functions, you'll be sending vertices individually to the video card, it has quite an impact on performance compared to sending a large array all at once. If you use vertex arrays, you'll see a massive performance increase.
Quote:Original post by Brother Bob
Who says the performance drop is drastic and just drawing a single quad is expensive? Look at the rendering times; you decrease the framerate from 5000 FPS to 1500 FPS. That means the quad scene takes about 0.47 milliseconds longer per frame to render. That is the same drastic performace drop you have when going from 30 fps to 29.6 fps. Hardly noticable in other words.

You're making linear conclusions out of a nonlinear quantity. FPS is not linear, but rendering time is. That is what you should measure and draw conclusions from.


Ah, is that the seconds per frame? How do you calculate that? If SPF is a better measurement of performance than FPS, then why do people tend to quote FPS as opposed to SPF?


Quote:Original post by ScottC
With glVertex functions, you'll be sending vertices individually to the video card, it has quite an impact on performance compared to sending a large array all at once. If you use vertex arrays, you'll see a massive performance increase.
from.


I'm working my way through the OpenGL superbible and I'm just playing around with some of the early code, although vertex arrays etc... and the pipeline stuff doesn't appear until later. Although I'll bear that in mind while playing around with the demos.


Thanks for your time everybody.
NB.
Quote:Original post by NewBreed
Quote:Original post by Brother Bob
Who says the performance drop is drastic and just drawing a single quad is expensive? Look at the rendering times; you decrease the framerate from 5000 FPS to 1500 FPS. That means the quad scene takes about 0.47 milliseconds longer per frame to render. That is the same drastic performace drop you have when going from 30 fps to 29.6 fps. Hardly noticable in other words.

You're making linear conclusions out of a nonlinear quantity. FPS is not linear, but rendering time is. That is what you should measure and draw conclusions from.


Ah, is that the seconds per frame? How do you calculate that? If SPF is a better measurement of performance than FPS, then why do people tend to quote FPS as opposed to SPF?

SPF = 1/FPS. Which is better depends entirely what you want to get from the measurement. FPS is probably easier to understand, but SPF is the linear quantity you compare differences with.
I'd assume people tend to quote FPS because it is the "visible" quality of a game. Something running at "20fps" just feels
sluggish, where as "60fps" feels smooth. So the fps is more of a quantifiable number associated with the quality of service.

What you should be worrying about is your target quality of service. If you want to run at 30fps, then you need to ensure that
no frame takes longer than 33ms to process and render. And base your performace calculations on how much of that 33ms
slice you have for each frame is being used, (ie the linear comparisons of frame times)

This topic is closed to new replies.

Advertisement