Sign in to follow this  

glVertex2i vs glNormal3i (Bad performance hit)

This topic is 4057 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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites

This topic is 4057 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this