 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jeremy Guest
|
Posted: Mon Feb 09, 2004 3:42 pm Post subject: Slow OpenGL rendering |
|
|
Hey, I'm having some major problems getting a decent FPS (frames per second) rating from even the most simple of OpenGL projects. For instance, I can create a colored, lit cube at 75 FPS (my current refresh rate, so I'm happy), but the second I apply a texture to it, the scene drops to BELOW 40 FPS. Then, to make sure it wasn't just the overhead of the texture unit, I added 8 more cubes to the scene and dropped the FPS all the way to 18. Meanwhile, the same code, modified a bit on MSVC runs at well over 50 FPS, with all textures, lighting, and cubes.
Just curious...has anyone experienced this? One of the only things I had to modify going to MSVC was #pragma package(smart_init) I think...not too sure about it. I'm not looking at the code. But I'm at a total loss. I have no idea why it's rendering so slowly...Any ideas? Thanks in advance.
|
|
| Back to top |
|
 |
Tomasz Piasecki Guest
|
Posted: Mon Feb 09, 2004 3:58 pm Post subject: Re: Slow OpenGL rendering |
|
|
Jeremy wrote:
| Quote: | Hey, I'm having some major problems getting a decent FPS (frames per
second) rating from even the most simple of OpenGL projects.
Maybe your hardware doesn't support OpenGL and it is software-rendered? |
Maybe some driver is missing?
TP.
--
| Quote: | _ _ _ |
_____ _| |_| | __ (o) | | __ __ @poczta.onet.pl |
| | | |o | | |/o |/ _| |
|_|_|_| _| |__/|_| |_|__|__||_| Tomasz Piasecki |
|
|
|
| Back to top |
|
 |
Jeremy Guest
|
Posted: Mon Feb 09, 2004 4:15 pm Post subject: Re: Slow OpenGL rendering |
|
|
Tomasz Piasecki <mtbrider (AT) _-nospam-_ (DOT) poczta.onet.pl> wrote:
| Quote: | Maybe your hardware doesn't support OpenGL and it is software-rendered?
Maybe some driver is missing?
|
This is unlikely. All the games I have which use OpenGL render at 35-50+ FPS, and have considerably more than 108 triangles (9 cubes * 6 sides * 2 triangles). For example, Oni used to run at nearly 60 frames per second, and used some of the newer OpenGL ARB extentions. I don't think my drivers or OpenGL implementation is the problem. But, in case the opengl32.lib included with BCB6 is the problem, I'll replace it with one directly from the OpenGL SDK later. ^_^ (Also, to contradict this possibility, David Brackeen's Java 3D Software Renderer [http://www.brackeen.com/javagamebook/] ran faster than my program, and it has all the overhead of Java. XD)
|
|
| Back to top |
|
 |
Andrew Fenton Guest
|
Posted: Mon Feb 09, 2004 5:44 pm Post subject: Re: Slow OpenGL rendering |
|
|
It has been my experience that the ChoosePixelFormat function considers your
PixelFormatDescriptor (PFD) structure to be a list of suggestions.
ChoosePixelFormat selects what it thinks will most closely match your PFD's
requirements. Thus, if your program uses ChoosePixelFormat to set up the
graphics mode for your device context, it may actually be selecting a
software rendering mode, without regard to your drivers or hardware.
There are programs which list the characteristics of each of your computer's
pixel modes. If you specify an actual pixel mode that supports your
hardware, maybe your FPS will improve.
Regards,
Andrew
|
|
| Back to top |
|
 |
Andrew Fenton Guest
|
Posted: Mon Feb 09, 2004 11:00 pm Post subject: Re: Slow OpenGL rendering |
|
|
"Andrew Fenton" <andrew.fenton (AT) ropak (DOT) com> wrote
| Quote: | There are programs which list the characteristics of each of your
computer's
pixel modes. If you specify an actual pixel mode that supports your
hardware, maybe your FPS will improve.
|
Just to clarify what I meant, I was proposing that you explicitly call the
pixel mode you want after inspecting each mode's particular characteristics.
Perhaps you could use a call like the following:
int PixFormat = 3; //my preferred pixel mode
SetPixelFormat(hdc, PixFormat, &pfd);
instead of
int PixFormat = ChoosePixelFormat(hdc, &pfd);
SetPixelFormat(hdc, PixFormat, &pfd);
I like PixFormat = 3 or 4 because, on my machine, modes 3 and 4 support
double buffering but do not have their PFD_GENERIC_FORMAT flag set. This
means that the pixel format uses the hardware rather than the software
implementation.
I made a Win32 executable (not just a console app) that lists for me the
pixel format characteristics for each supported format, as well as the GL
and GLU extensions on whatever machine the application runs. If you are
interested in it, let me know. Its not the most polished application as I
am fairly new to programming, but it is functional for helping you decide
which explicit pixel mode to choose on a given machine.
Regards,
Andrew
|
|
| Back to top |
|
 |
Jeremy Guest
|
Posted: Tue Feb 10, 2004 1:27 am Post subject: Re: Slow OpenGL rendering |
|
|
| Quote: | Just to clarify what I meant,
|
Actually, I thought you did a good job of explaining it, and I was quite shocked to find out there are 56 different pixel formats, going all the way down to 4 bits per pixel. Anyway, that wasn't the problem. My "mode" 10 was a compatible mode, and hard ware accelerated but didn't fix the problem. Oh well...maybe it is just that my video card sucks. ^_^
|
|
| Back to top |
|
 |
Andrew Fenton Guest
|
Posted: Tue Feb 10, 2004 3:36 pm Post subject: Re: Slow OpenGL rendering |
|
|
O.K. Perhaps your video card is not the most ideal for what you are trying
to do.
But, I'd bet that this answer does not satisfy you, especially considering
the difference between your Borland compilation of this program and your
MSVC compilation. In your original post, you described a difference of more
than 10 FPS between the two. Also, you have noted the great performance of
some other OpenGL software that you have used.
You also "modified a bit" your code for the MSVC version. What sort of
change was this?
As to the difference between your two compilations, I suspect (or guess)
that you may be hitting more of a CPU-limit on the Borland compilation due
to differences in resource handling. Please take my comments with a grain
of salt, though, because I'm still pretty new to some of these programming
issues and I do not use MSVC. Is one using dynamic linking and the other
static by default? There are a variety of conditions which may either one
better than the other for a particular application.
If you've done a minimum of reading on this subject, you know that the
typical bottlenecks for OpenGL performance are Fill limits, Geometry limits,
and CPU-limits. This information is elaborated a bit in the technical FAQ
at http://www.opengl.org/resources/faq/technical/performance.htm#perf0010.
By all means, read this section if you are not familiar with performance
issues.
Apart from upgrading your video hardware, there is not much to be done for
the fill or the geometry limits, particularly if larger screen sizes or
prettier graphic effects are a must (and they are). However, alot of
factors play into the CPU-limit issue. Given the change in performance of
your application with a different compiler, I would guess that the compilers
are compiling the app to handle resources differently. Often though,
default compiler behavior can be changed...
Regards,
Andrew
|
|
| Back to top |
|
 |
Jeremy Guest
|
Posted: Wed Feb 11, 2004 3:40 am Post subject: Re: Slow OpenGL rendering |
|
|
Actually, I think you're right...I think the format for the video card is incorrect, and I was wrong about the FPS from MSVC. Stupid calculation error...turns out they get approximately the same frame rate, but I made a really novice mistake, failing to initialize my frame counter. <smacks forehead> Fortunately, it's all fixed now. ^_^ Thanks for your help and suggestions though. XD I did stumble across something which supposedly makes OpenGL graphics faster, Vertex Buffer Objects. Gunna hafta read more on that.
"Andrew Fenton" <andrew.fenton (AT) ropak (DOT) com> wrote:
| Quote: | O.K. Perhaps your video card is not the most ideal for what you are trying
to do.
But, I'd bet that this answer does not satisfy you, especially considering
the difference between your Borland compilation of this program and your
MSVC compilation. In your original post, you described a difference of more
than 10 FPS between the two. Also, you have noted the great performance of
some other OpenGL software that you have used.
You also "modified a bit" your code for the MSVC version. What sort of
change was this?
As to the difference between your two compilations, I suspect (or guess)
that you may be hitting more of a CPU-limit on the Borland compilation due
to differences in resource handling. Please take my comments with a grain
of salt, though, because I'm still pretty new to some of these programming
issues and I do not use MSVC. Is one using dynamic linking and the other
static by default? There are a variety of conditions which may either one
better than the other for a particular application.
If you've done a minimum of reading on this subject, you know that the
typical bottlenecks for OpenGL performance are Fill limits, Geometry limits,
and CPU-limits. This information is elaborated a bit in the technical FAQ
at http://www.opengl.org/resources/faq/technical/performance.htm#perf0010.
By all means, read this section if you are not familiar with performance
issues.
Apart from upgrading your video hardware, there is not much to be done for
the fill or the geometry limits, particularly if larger screen sizes or
prettier graphic effects are a must (and they are). However, alot of
factors play into the CPU-limit issue. Given the change in performance of
your application with a different compiler, I would guess that the compilers
are compiling the app to handle resources differently. Often though,
default compiler behavior can be changed...
Regards,
Andrew
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|