• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# OpenGL help!!! - opengl performance

## Recommended Posts

Help!!! I have < 15 FPS at 2000-3000 triangles drawn! On a Athlon Thunderbird 800 with nVidia geForce 2 GTS with the newest detonator-driver!!! What''s going on? No texturing, only smooth shaded coloured triangles in COMPILED DISPLAY LISTS. There is one display list for each node of my octree. howdy, gahre

#### Share this post

##### Share on other sites
Perhaps something else in your code?

With my engine, Im doing 5700+ triangles at 120fps, using a quad-tree for culling, using textured tri-strips in display lists for drawing. Also taking care of collision detection and direct input for both keyboard and mouse, running without optimizations, etc.

Im running a GeForce, p3-600, latest DetonatorXP drivers.

#### Share this post

##### Share on other sites
Whoah! What the hell? I''ve already searched for some expensive stuff in my code, but didn''t really find anything. there must be a mistake in my code that slows the whole thing down. The funny thing is:

If I reduce the number of triangles I get ~75 FPS at 40 tris drawn and ~75 FPS at 600 tris drawn. Maybe it is because I use allegro+win32api??? Or my timer measures wrong (but it has always worked before) maybe the win32api doesn''t like my timer??? I found out that if I give hDC to my octree-building finc to put out some text stuff it is f**king slow if timing is enabled - why that?

#### Share this post

##### Share on other sites
Are you sure you aren''t regenerating the displaylists every frame? If so, change that :o). Also, what about fillrate? what''s the size of the triangles? It might be that you have too much overdraw.. use some kind of occlusion culling for that.. (Occluders might be an idea..)

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

#### Share this post

##### Share on other sites
quote:
Original post by gahre
Whoah! What the hell? I''ve already searched for some expensive stuff in my code, but didn''t really find anything. there must be a mistake in my code that slows the whole thing down. The funny thing is:

If I reduce the number of triangles I get ~75 FPS at 40 tris drawn and ~75 FPS at 600 tris drawn. Maybe it is because I use allegro+win32api??? Or my timer measures wrong (but it has always worked before) maybe the win32api doesn''t like my timer??? I found out that if I give hDC to my octree-building finc to put out some text stuff it is f**king slow if timing is enabled - why that?

The FPS locking at 75 is probably because you have your monitor refresh set at 75Hz and OpenGL waits for the vertical retrace. Nothing is wrong with that. If you want to see the true FPS you should change the "Vertical sync" option in the OpenGL settings for your driver to "Off by default" or "Always off" (the exact names may differ for you).

#### Share this post

##### Share on other sites
Well, that 75 FPS problem is solluted now, but the overdraw stuff not yet. The size of my tirangles is indeed one of my problems, because if I want to prevent triangles from being drawn twice of several times, There is zig-zag where the frustum is culled, I have to include some triangle splitting stuff for my octree nodes. Now I get about 140 FPS at 90 triangles drawn - not very fast! I can''t find any expensive stuff in my code (it''s pretty messy) - but I''m not THE programmer, it''s just a little hobby, so the code is not optimized.

#### Share this post

##### Share on other sites
mybe I should use triangle strips in my display lists? Will this be much faster?

#### Share this post

##### Share on other sites
Yes, use triangle strips.. they will not speed up rendering _alot_ but they''ll save quite some memory from the display list... I didn''t exactly mean splitting up your triangles is that important.. I wonder how much each triangle covers the screen (-> how much overdraw you''ve got)..

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

#### Share this post

##### Share on other sites
Another thing: Is there a lot of Alpha blending and stuff like that going on? Disable Alpha test if not needed :o))

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

#### Share this post

##### Share on other sites
No, no alpha blending going on (so far) and no alpha testing enabled (of course).

I reached ~160 FPS at 90 tris now. I altered the far value in gluPerpective. (to 35.0 :-((((( )

#### Share this post

##### Share on other sites
When you draw your text, do you use bitmapped fonts?
This may be part of your problem. I''m no expert, just started
learing OpenGL myself recently, but when i use the bitmapped
fonts to draw my text it kills the frame-rate. Although i think
that is a problem related to my Voodoo2 card, i''m not sure.
Has anyone else experiensed problems with bitmapped fonts?

#### Share this post

##### Share on other sites
BTW, when i say bitmapped fonts i mean the stuff
that NeHe show in one of his tutorials.

#### Share this post

##### Share on other sites
gahre:

There is something *very* wrong with your engine. On optimal programming (vertex array range, DrawRangeElements, tristrips, direct AGP DMA''s, etc) my engine renders around 180000 triangles at ~40 fps on a GeForce2 GTS. But only very small ones, or you''ll get fillrate limited.

- AH

#### Share this post

##### Share on other sites
Yeah.
You should be getting nice framrates...hmmm.
What exactly is your program doing ?
What OpenGL commands, what data structures, whats the rendering doing, what ai stuffs going on, blah blah blah blah.
I know you said octrees, smooth shaded tris, compiled display lists, but could you list more of whats going on ?
~V''lion

I came, I saw, I got programmers block.
~V''''lion

#### Share this post

##### Share on other sites
Well, actually there''s not much going on besides Input stuff, drawing and collision detection. No AI, nothing. I just check for input, transform, draw, do collision detection and then move the player. In my octree I am using compiled display lists for drawind, but the other mothod with glBegin and glEnd brings better results, don''t ask me why, I don''t have the slightest idea. Maybe there''s some other stuff that is faster, because the version with the conventional (???) method is older.

cheers,

Gahre

#### Share this post

##### Share on other sites
How are you doing your collision detection? Are you testing every triangle or just a couple?

Have you tried profilling your project to see whats taking up all the time?

Care to post the source so we can have a look through to try spot whats going on?

#### Share this post

##### Share on other sites
I only test a couple, only the node the player is in and only the triangles with whose bounding boxes the player collides.

Post the source? where? in the forum? -> too big, isn''t it?

#### Share this post

##### Share on other sites
You might be using a software-only feature. Check for any usage of the accumulation buffer... Also, don''t do any stipple transparency.

Also try reinstalling DirectX. Microsoft made Windows require it even for OpenGL.

I once disabled DirectDraw and got the same type of performance problems.

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627689
• Total Posts
2978648
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
Thank you in advance!
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 13
• 14
• 12
• 10
• 12