Advertisement

Texture coordinates and vertex arrays

Started by February 26, 2003 03:58 PM
14 comments, last by DalTXColtsFan 22 years ago
as for the question about what disadvantage having 24 verts and not 8 would be, it''s basically none. since your using different data at each vertex, and possiblity of taking advantage of the vertex cache is gone anyway.
making a call to glDrawElements is one of the slowest things you can do so make absolutly sure that your drawing as many tris as possible each call. around 500+ is a good number. And have a look into VAO/VAR, these really bring perfromance out of drawElements.

| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |
Thanks a ton everyone. I''ll rewrite my city using vertex arrays and frustum culling and see what kind of boost I get. Shouldn''t take too long.
Advertisement
if you can batch all your rendering into as few draw elements calls as possible (the best example would be one for each texture you use, but that isn''t easy) then your performance should be considerable.
assuming that is that fillrate or something else isn''t a bottle neck.

| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |
http://home.att.net/~tennisman5/ACity.zip

Here''s the latest version of the code. I made the following changes:

1. Added mipmapping
2. Added frustum culling (borrowed code from GameTutorials)
3. Used a sphere for the skybox instead of a cube
4. Not rendering the bottoms of the buildings
5. Made the viewing frustum much smaller (it was up to 1000).

And 13fps became about 22. And it looks much better with mipmapping turned on.

I also fixed what I was doing wrong with the normal vectors so the day-to-night feature works a little better now, but still if you look down one of the streets at just the right angle the buildings appear illuminated even when they''re supposed to be pitch black.

I''m still not completely happy with it. I think I need to figure out the math of that frustumculling thing because sometimes it culls things that are right in front of me. I had a hunch that frustum culling wouldn''t help me too much because there are places where you can see the entire city.

I''m going to try vertex arrays next - I think part of the problem is some of the buildings are just too darned tall. I''m going to try breaking them up into separate squares and not rendering the faces in the middle.

But thanks for everyone''s help. It''s been educational for sure!
I gave the app a go.
could not get it to compile in release mode. which was odd.

sat around ~250fps. minimum I got it to was 120 at 1600x1200.

I''d guess you biggest problem is definitly overdraw, which in this case would not be easy to fix.


to fix the lighting problems make sure you set the light direction (for infinite lights you use position for direction with the w component as zero), and set it after you set the camera, and always set it to the same position.

| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |
after looking at the code:

use a single GL_QUAD begin/end instead of multiple GL_POLYGON begin/ends.

for the fustrum checking, do it using a sphere on the entire building. Fustrum culling is most benificial for reducing polygon counts off screen. 5 polygon buildings arn''t really an issue here... and doing a full 20 frustum checks per building is excessive. even 1 is excessive, honestly.

| - Project-X - my mega project.. yup, still cracking along - | - adDeath - an ad blocker I made - | - email me - |

This topic is closed to new replies.

Advertisement