Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Jun 2002
Offline Last Active May 28 2016 07:34 AM

Posts I've Made

In Topic: Manually loading OpenGL functions on Windows

17 May 2016 - 08:17 AM

To be honest you're making things more complicated for yourself than they need be.  The process of linking to and using OpenGL on Windows is simple so long as you follow the rules and are aware of what functions are available with each GL version.
You #include <gl/gl.h>
You statically link to opengl32.lib, via either project settings or #pragma comment (lib, "opengl32.lib")
At this stage all of OpenGL 1.0 and 1.1 is available to you without needing to do anything else.  No need for GetProcAddress, no need for wglGetProcAddress.

For typical windows apps, you're correct. For minimal 64k apps though, manually loading OpenGL is not a bad idea. You can allocate a table to store the pointers at runtime, which actually cuts down the number of global variables in your exe (which would have been used to store each function pointer to a glcall you are using). You can also concatonate strings to build up the function names to extract. It may seem like overkill, but it does actually cut down on memory usage. It's a very common approach in the demo scene....

In Topic: Bubble Sort Algorithm Review

12 May 2016 - 07:51 PM

Your display list function....

It could take a const ref to the vector (rather than making a copy each time).

Again, that counter has returned!

If you want to see if the vector is empty, use the empty method! (size is typically implemented as a subtraction, so can be very modestly more expensive). Therefore repeatedly checking whether counter is equal to the size() is not considered good practice!

The if(iter != list.end()) check in the for loop is pointless. That condition is already checked by the for loop condition, so it can never enter the 'else'

Repeatedly doing if/else's for commas is probably a bad idea.

if(theList.empty()) {

// blah


else {

  auto it = theList.begin();

  auto end = theList.end();

  cout << *it++;

  for(; it != end; ++it)

    cout << ", " << *it;


In Topic: Bubble Sort Algorithm Review

12 May 2016 - 07:36 PM

Your for loop seems a bit rubbish :)

Why use iterators as your for loop condition, and also employ a counter? You could just use a counter? That would allow you to avoid the constant if/else within the loop (since your end condition can be size - 1).

The alternative, would be to use two iterators (which may save some additional costs associated with the array element access - not in itself expensive - but since you are passing in a reference to a vector, some compilers may force an additional pointless load op on 'begin' for each element access). Again, you can engineer your loop to test the 'next' element is not equal to end.

if(theList.size() < 2) return;

auto end = theList.end();

bool altered_list = true;



  altered_list = false;

  auto it = theList.begin();

  auto next = it + 1;

  for(; next != end; ++it, ++next) {

    if(*it > *next) { 

      std::swap(*it, *next);

      altered_list = true;




I suppose the correct way to swap elements would be with std::swap, which would remove the 'temp' variable, and make the code a little clearer to read.

The pass through counter seems to be a little superfluous (unless it's just a formatting thing).

The 'sorted' flag serves no purpose. You already have 'altered_list', which gives you the same information.

In Topic: N64, 3DO, Atari Jaguar, and PS1 Game Engines

22 April 2016 - 10:44 AM

Back in the day there was the net yaroze, and you can still find them on eBay: http://pages.ebay.com/link/?nav=item.view&alt=web&id=351701873219&globalID=EBAY-GB

To be honest though, they're expensive, and woefully underpowered with limited information around to help you develop games. I had one, but it wasn't as exciting as playing with newer hardware (Multi-texturing on an OpenGL 1.2 capable ATI rage fury + overclocked celeron 300 in my case)

This stuff is interesting from a historical perspective I guess, but I've always found new shiny to be more interesting....

In Topic: What is more expensive in float?

19 April 2016 - 06:38 PM

Oh, and if anyone copies & pastes the Quake 3 reciprocal sqrt into their source code, go outside and shout: "I am a terrible human being!", repeatedly, for the rest of time.