Jump to content
  • Advertisement
Sign in to follow this  

slow rendering with ATI

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

When i draw triangles like this with classic light : glEnable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(3, GL_DOUBLE, 0, pt_ptsGL); glNormalPointer(GL_DOUBLE, 0, pt_normalsGL); glTexCoordPointer(2, GL_DOUBLE, 0, pTexGL); for(int i = 0; i < nb_triangles_reels; i++) { glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, pt_triangles.vertexIndices); } glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisable(GL_TEXTURE_2D); It's ok with Nvidia Graphic card but it's very slow with ATI card (9700 last drivers). And when i use shader by adding these lines, it's still ok with Nvidia card and it's ok too for ATI card (very much faster then without shader) shader_object.glUseProgramObjectARB(shader_object.g_programObjTex); shader_object.SetShaderConstantsTexture(Ka, Kd, Ks, nspecular, ambientProperties, diffuseProperties, specularProperties, light_pos); shader_object.SetShaderTexture(texture[0]); ...code higher if (shader_active == TRUE) shader_object.glUseProgramObjectARB(NULL); Anyone has an idea of why with simple light it's so slow with ATI card? Thx

Share this post

Link to post
Share on other sites
No one has an idea of what cause ATI 9700 to be slow with this simple model of light and not with shader?

Share this post

Link to post
Share on other sites
more out of intrest than anything else, why on earth are you using GL_DOUBLE for the data? They arent even remotely native to the GPU, GL_FLOAT is the prefered and advised data type. My guess is that under the fixed function pipeline you've fallen off the accelerated path on the 9700 and yet the shader does something to either cover it up or help in some way

oh, and just a polite note for future reference, 3hours isnt that long in the life of the msg board, so before bumping wait a little longer please [smile]

Share this post

Link to post
Share on other sites
Its definitely the GL_DOUBLE. A while ago I was using GL_FLOAT for sending color data to my ATI 9800 and I was getting horrible frame rates. So I switched to GL_UNSIGNED_BYTE and the framerate went up by about 50x. I'm not sure why, probably a driver problem, but it worked.

Share this post

Link to post
Share on other sites
you've changed all the double code to floats, yes?
colours are the only thing you should send down as unsigned bytes (and even then you need to send rgba to keep it properly aligned).

How many triangles are you sending per batch?
Which NV card are you testing on?
What other states are active?
What format is the texture in?
Are you mipmaping the texture at all?
What are you doing with teh z-buffer?
What format is your triangle data in? (strip'd list? raw random triangles?)

Share this post

Link to post
Share on other sites
ATI is very, very, vera sensitive to the data format you supply vertex arrays. nvidia optimized pretty much every possible data type. But ATI have a few highly optimized paths, and all others are slow beyond belief.

There used to be an ATI performance FAQ that addressed these issues, and listed the data formats to use. I can't find the link, unfortunately.

As far as I remember, vertex positions need to be 3 x GL_FLOAT, colours need to be 4 x GL_UNSIGNED_BYTE, and I don't remember about texture coordinates. Might have been either 2 x float, 3 x float, or 2 x short.

Share this post

Link to post
Share on other sites
Yes i've changed all the double code to floats (declaration and in the functions).
Even with no texture it's slow.
The NVIDIA CARD is FX5200 but it's ok with my old 4200 (but shader are black???) and it's ok on my laptop with a NV 5600GO.

Triangle are not in strip, they are drawn 1 by 1.

Initialisations :


float lumiere_position_not_shader[] = {0.0f, 0.0f, 1.0f, 0.0f};

glLightfv(GL_LIGHT0, GL_AMBIENT, this_file.ambientProperties);
glLightfv(GL_LIGHT0, GL_DIFFUSE, this_file.diffuseProperties);
glLightfv(GL_LIGHT0, GL_SPECULAR, this_file.specularProperties);
glLightfv(GL_LIGHT0, GL_POSITION, lumiere_position_not_shader);
//glEnable(GL_LIGHTING); //enabled when i render


// Perspective
CRect rect;
double aspect = (rect.Height() == 0) ? rect.Width() : (double)rect.Width()/(double)rect.Height();

// Default : blending

// Default : material
float MatAmbient[] = {0.0f, 0.33f, 0.50f, 1.0f};
float MatDiffuse[] = {0.5f, 0.5f, 0.5f, 1.0f};
float MatSpecular[] = {0.1f, 0.1f, 0.1f, 1.0f};
float MatShininess[] = { 84 };
float MatEmission[] = {0.5f, 0.5f, 0.5f, 1.0f};

// Back : green
float MatAmbientBack[] = {0.0f, 0.5f, 0.0f, 0.1f};


// Modulate : texture lighting


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!