ogl simple program performance

nobond

Newcomer
I am writting a simple mesh viewer via ogl. It is pretty simple. Non-textured, only geometry, and one light.
There are about 1.5K vertices and 2K quad(which i translate into 6K tris)
The hardware is also reasonable:
==========================
AMD 2.7 GHZ Duo-Core + 4G RAM
ATI Radeon 3300 + 512M Video Memory
1T HardDisk
There are
===========================
P.S. I am new to 3D programming, I just use the normal immediate mode (glbegin ..end stuff).

I test the program, it only got about 3 frame per second!!! I kind of think this is a bit too unreasonable slow?? Or something fundamentally wrong? Should I change to vertex buffer, gldrawelement to accelerate things up?
 
That is too slow event for immediate mode. You are doing something very bad in your code.
Anyway - moving to vbo is recommended. Immediate mode is deprecated in gl3 and removed in gl3.1
 
That is too slow event for immediate mode. You are doing something very bad in your code.
Anyway - moving to vbo is recommended. Immediate mode is deprecated in gl3 and removed in gl3.1


Hmm, it is nothing but glVertex()glNormf surrounded by glbgn and glend pairs.

BTW, I am using the windows visual c++ express 9.0. not sure will this contribute to the bad performance as well ?
 
You should put as many as you can glVertex calls inside each glBegin/glEnd pair. If you will, for example, use glBegin/glEnd for each individual triangle/quad, then you will get very bad performance.
 
That is all my draw stuff, nothing looks odd i think
glBegin(GL_TRIANGLES);
for (size_t face = 0; face < NumFaces(); face++) {
int num_verts = NumVerticesInFace(face);
int a = GetVertexIndex(face, 0);
int b = GetVertexIndex(face, 1);
for (int i = 2; i < num_verts; i++) {
int c = GetVertexIndex(face, i);
STVector3 N = STVector3::Cross(GetVertex(b) - GetVertex(a),
GetVertex(c) - GetVertex(a));
glNormal3f(N.x, N.y, N.z);
int indices[3] = {a, b, c};
for (int v = 0; v < 3; v++) {
const STVector3& posn = GetVertex(indices[v]);
glVertex3f(posn.x, posn.y, posn.z);
}

b = c;
}
}
glEnd();
 
Last edited by a moderator:
Sounds like you're getting software rendering for some reason. With only 6k tris you should get a few hundred fps even in imediate mode with HW rendering.
 
Yes. that is my guess. I am trying to use the glDrawarray, only tiny speedup.
How i can make sure i am actually using the 3d card. I thought windows is doing so smartly?

Sounds like you're getting software rendering for some reason. With only 6k tris you should get a few hundred fps even in imediate mode with HW rendering.
 
If you do something in OpenGL that isn't supported by hardware, it'll automatically fall back to software mode, I believe.

I think it was meant to be a feature, but it sounds more like a gotcha if you ask me.
 
Do you actually have the ati drivers installed or are you using some windows shipped thing?
Try ask opengl about the renderer: glGetString(GL_RENDERER); and glGetString(GL_VENDOR);
 
Back
Top