Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 22 Jun 2002
Offline Last Active Nov 21 2014 09:31 AM

Posts I've Made

In Topic: Software Fallback?

11 November 2014 - 09:10 AM

AFAIK, HD 3xxx series should go up to OpenGL 3.1 on Windows, 3.3 on Linux with Mesa. Not sure what's the situation in OSX world, didn't they supported up to 3.2 with those cards?


Technically 3.1 (due to a few missing features from 3.2 and 3.3), but the HD 3000 supports version 400 GLSL strangely.

In Topic: DLL Import Failure

18 July 2014 - 10:15 AM

Right, but what if I wanted to use 2 DLLs in the same project, and one is 32 bit and the other is 64 bit, is it impossible to make any program that will use both DLLs?  That seems absurd.


If you need to mix 32bit + 64bit DLL's, then the only option you have is to use an IPC approach (pipes, named pipes, network socket), and use that to connect two applications together. It's neither nice, nor fun. Ditch the 32bit DLL and move on.... :)

In Topic: How to pack your assests into one binary file (custom file format etc)

18 July 2014 - 10:11 AM

How you do this is entirely up to the developer. There is no standard approach really.... 


On some occasions, it can be nothing more complicated than a zip or tar file.

Sometimes it may be a custom compressed file (probably using something like libZip to do the compression/decompression, and a custom header that will ensure it can't be opened as an archive). 

Sometimes it may simply be a serialised memory dump containing all of the assets for a level. 

And every so often, you may come across someone who uses encryption to add another layer of annoyance for people trying to rip the assets! 


Whether or not a developer wants people to be able to navigate their asset packages, is going to depend largely on whether they care about protecting their art assets or not. For some games companies that support extensive modding in their games, they are likely to be much more open with their asset packages than a company that does not support modding. Ultimately there is no company wide standard governing this.... 

In Topic: openGL, rotation, collision

04 June 2014 - 08:46 AM

If all the points are around the origin if the object and you are drawing something like Asteroids, rotate first, then translate. Once.


	void showLine(){
		glRotatef(0.0f,0.0f,rot);				// glRotatef() has 3 parameters.  Rotate around Z.
		glTranslatef(SCREEN_WIDTH/2,SCREEN_WIDTH/2,0.0f);	// Then move to the center of the screen.

		// Or move to the position of the object relative to the center of the screen.

	}//this is only one line segment

I have looked on line and that's what appears to be the common method.

It was common perhaps 20 years ago. It’s outdated and deprecated, meaning no longer supported and not the common way anymore.

L. Spiro




Spiro, the original code was correct. You might not like what he's doing, but he is simply changing a pivot. That is a standard approach, the runtime cost is negligible, and whilst it might not be something I'd recommend, it isn't actually wrong at all. The original code is also using glRotatef correctly (it does not take 3 parameters - it takes 4 - The angle, and the axis. Any rotate function that takes 3 args, is a gimbal-locking function best avoided!).


Let's say I have an asteroid with 50 points, that's a lot of resources it seems to figure out for each iteration where 49 lines are. My question is can I use glRotation (since it is already crunching all the numbers and knows where every pixel is located) to figure out my: start.x,start.y,end.x,end.y for all lines in an object.


You won't be able to use glRotate, but you can use a matrix to transform the points instead. (it might be worth computing your own transforms, and glMultMatrix instead of glRotatef/glTranslatef). CPU's are faster than you think, so there should be no significant performance problem in doing that. Just be aware that if you want to port you code to GL3+ at any point, you'll need to do your own matrix calculations anyway. You might as well start now - it'll be less hassle in the future. 

In Topic: Programming for software intermingling(?)

01 June 2014 - 03:13 PM

How would I find that out? Its a very basic file of a frequency wave and a few text saved as a ".dat".


Open it in a HEX editor?  (or text editor if it's a text based file?) Or consult the file format spec? Swiftcoder is right. Effectively you have a data-structure, albeit one that's been serialized to disk. The structure of your data will, to a large extent, influence how relevant or applicable the advice we give will be. This returns the contents of any file as a string:


std::string loadFile(const char* filename)

  std::string p;
  std::FILE* fp = std::fopen(filename, "rb");


    std::fseek(fp, 0, SEEK_END);

    size_t s = std::ftell(fp);


      std::fseek(fp, 0, SEEK_SET);

      std::fread(&p[0], 1, s, fp);

  return p;



Now, you wouldn't actually want to use that. Probably. Maybe. Possibly. Who the hell knows? Take the gamble? Phone a friend? I don't know, nor does anyone else.


To use a car analogy:  The above code gives permission for a passenger to open a car door. Swiftcoder is merely asking what your passengers will find beyond that door. Will they find that the car is stationary? Will they find the ground rushing past them at 70mph? Will they find that the car has actually been compressed, in a vice, and that the doors cannot open?


How you tackle problems of this sort are 'usually' formulaic. I'm happy to step onto tarmac that isn't moving, less enthusiastic when it's moving at speed (stop first!), and would like to know whether I should keep my mobile on me, just in case someone tries to squish me in a vice.