POV-Ray : Newsgroups : povray.off-topic : Learning C++ : Re: Learning C++ Server Time
6 Sep 2024 23:23:50 EDT (-0400)
  Re: Learning C++  
From: stbenge
Date: 12 Dec 2008 10:43:01
Message: <49428685@news.povray.org>
Warp wrote:
> From the example codes I have seen of the HGE
> library, it might not be the easiest possible to use either.

I wish I knew how to comment from an OOP background, but I've been 
putting off learning about classes/inheritance/polymorphism until now :/

>   You could consider this one too, which would make your program much
> more portable:
> 
> http://www.libsdl.org/
> 
>   However, I unfortunately have absolutely no experience in using it,

I have experience with it, and I can tell you this: getting a reliable 
VSYNC is difficult or impossible. I have looked high and low for a 
solution. Either I didn't use the correct search terms, or there isn't 
an obvious way to get a VSYNC with SDL on every platform. Most of the 
discussion I found was of people having their frame rates capped between 
60 and 100 FPS (monitor refresh rate), yet with the same settings I did 
not experience an FPS cap in any way. I have been getting between 
400-1000 FPS, which means there is no capping going on because I'm not 
getting a VSYNC with my programs. This leads to ugly things like jerky 
motion and screen tearing. I have a relatively new graphics card, so 
outdatedness is not an issue.

> nor
> do I know how easy it is to integrate in Visual Studio.

AFAIK, SDL is easy to set up in any language.

> Being a C library
> it will most probably be of a much lower level library than an abstract
> high-quality C++ library would be, and consequently probably hard to use.

Most tutorials will hand you functions for drawing pixels/loading 
images/drawing sprites/etc. on a silver platter.

Other than the VSYNC issue, another thing to consider when using SDL is 
the speed at which it operates. Compared to DirectX or OpenGL, SDL is 
slow. It's faster at drawing pixels, but slower at drawing sprites and 
alpha blending. Forget rotating a sprite unless speed is not an issue.

You can mix SDL and OpenGL, but doing this multiplies the mass of your 
code significantly. This is why I'm looking to OOP for answers. The 
combination is faster than SDL alone, but you lose some SDL 
functionality. But you gain better control over the VSYNC. You get to 
rotate sprites, have alpha blending, all those great things.

Watch out for HGE. It may be fast and great, but it hasn't had a good 
update for a while.

Sam


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.