Jump to content

  • Log In with Google      Sign In   
  • Create Account

Tac-Tics

Member Since 23 Jan 2002
Offline Last Active Jan 28 2013 02:49 PM

Topics I've Started

A standard way of generating a uniform distribution of floats in C.

24 March 2010 - 08:53 AM

Is there a standard technique for generating a uniform distribution of floating point numbers (floats and doubles) in C? From what I've found on Google, you need to use rand() and then coerce it to a float. But it seems unsafe to do if I want a truly uniform distribution. I don't really want to go into the details of floating point representation and random number entropy. Surely, this functionality is common enough to be available in the standard C library or in some relatively small 3rd party library (I'm not certain what platform I'll be on yet, either). Any help in finding such a library would be appreciated.

Looking at a large project for the first time

22 October 2006 - 02:05 PM

I'm a pretty good coder. I've worked at my University as a TA for intro level classes for 2 years now and I'm probaby one of the top 10 programmers in my school. However, I have never really worked on any very large projects before, and I feel that is a major disadvantage. The other day, I downloaded the source to my favorite open source game projects. I want to see how far I can get in modding it and I want to try to add a feature or two. However, having never worked with something as massive as this, I don't know where to start. Which brings me to my question.... When beginning to work with a large project for the first time, what do you do? Right now, I'm trying to get a feel for some of the common classes (base entity and screen classes). Does anyone have any strategies? How long do you usually need to spend before you can comfortably make basic changes to the source (and expect them to work)? This is an open-ended question, so be creative in your answers!

Troubles loading textures

19 October 2006 - 10:13 AM

I'm porting a game I wrote in Python using PyOpenGL and PyGame to SDL in C++. I am having troubles with my textures, and I have a suspicion that I'm not loading them correctly.
void LoadTexture(string textname)
{
	GLuint textureNumber;
	string filename = DATA_DIR + textname + string(".png");
	SDL_Surface* surface = IMG_Load(filename.c_str());

	glGenTextures(1, &textureNumber);
	textures[textname] = textureNumber; // textures is a global map.
	glBindTexture(GL_TEXTURE_2D, textureNumber);
	GLvoid* data = surface->pixels;
	cout << textname << "'s format is... " << endl;
	cout << "Bits per pixel: " << (int)surface->format->BitsPerPixel << endl;
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, surface->w, surface->h, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
	SDL_FreeSurface(surface);
}

Here is my original source which works just fine:
def LoadImage(filename):
    global textures
    image = Image.open("data\\%s.png" % filename)
    data = image.tostring("raw", "RGB", 0, -1)
    textures[filename] = glGenTextures(1)
    glBindTexture(GL_TEXTURE_2D, textures[filename])
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.size[0], image.size[1], 0, GL_RGB, GL_UNSIGNED_BYTE, data)
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)

Any ideas of what I might be doing wrong? What can I do to further troubleshoot texture errors? OpenGL will just let them pass silently and there's so much that can go wrong (is GL_TEXTURE_2D enabled? Are my coordinates correct?, etc), it's often hard to pinpoint where the error is.

[web] Java API to convert Word documents to HTML

13 September 2006 - 09:56 AM

I have an idea for a school project that allows users to post documents with a Wiki-like interface. There is one particular feature that I want, but I don't know how it can be implemented. That is, I want users to be able to upload MS Word documents to the server, then, when another user wants to look at that document, a servlet converts the Word document to HTML. If that user wants to make changes, they can then download the original MS Word doc. I know Google has something like this (their PDF and Word "View as HTML" system). It seems like converting these file formats to HTML would be such a common task that there must be an open API to help out with this.

[java] Getting a File handle to the Desktop

27 July 2006 - 08:09 AM

I'm trying to get a JFileChooser to default to opening the Desktop of the user. Is there any way to retrieve a File object that points to the active user's desktop?

PARTNERS