Jump to content

  • Log In with Google      Sign In   
  • Create Account


xissburg

Member Since 30 Apr 2005
Offline Last Active Nov 07 2012 12:52 PM

Topics I've Started

Improper rotations (reflections) with quaternions

03 June 2011 - 04:46 PM

Rotation matrices can perform reflections, also known as improper rotations, roto-reflections etc. One way to find out whether a rotation matrix represents an improper rotation is to check whether its determinant is negative. Can a quaternion represent such transforms? How to make a reflection quaternion?

Thanks.

OpenGL rendering incorrect texture colors

04 November 2009 - 11:43 AM

To load a texture from file and properly render it in OpenGL has been seriously boring me and...well that turned into a whole history now.. Since I'm using SDL in the project, I chose to use SDL_LoadBMP to load a texture (this project is very simple CG wise). And SDL loads it, and correctly. But when I render it as a texture in OpenGL The texture gets a greenish-brownish appearance. Then I loaded a texture with 100% red, blue and green large strips, took a screenshot of my app and color picked it in Photoshop (lighting is off). Then I noticed that the red and green are at 100% but the blue is at 50%. I really don't know what else I can do :/ HALP My simple load texture code:
SDL_Surface* surface = SDL_LoadBMP("groundTexture.bmp");

	if(surface == NULL)
	{
		std::cout << "Failed to load groundTexture.bmp" << std::endl;
		return;
	}

	Uint8 nOfColors = surface->format->BytesPerPixel;
	GLenum textureFormat = GL_RGBA;

    if (nOfColors == 4)     // contains an alpha channel
    {
        if (surface->format->Rmask == 0x000000ff)
                textureFormat = GL_RGBA;
        else
                textureFormat = GL_BGRA_EXT;
    } 
	else if (nOfColors == 3)     // no alpha channel
    {
        if (surface->format->Rmask == 0x000000ff)
                textureFormat = GL_RGB;
        else
                textureFormat = GL_BGR_EXT;
    }
        
	glGenTextures( 1, &groundTexture );
	glBindTexture( GL_TEXTURE_2D, groundTexture );
 
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	//glTexParameterf(GL_TEXTURE_2D, 0x84FE, 8);//hardcoded anisotropy
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);

	gluBuild2DMipmaps(GL_TEXTURE_2D, nOfColors, surface->w, surface->h, 
						textureFormat, GL_UNSIGNED_BYTE, surface->pixels);
	/*glTexImage2D( GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
                      textureFormat, GL_UNSIGNED_BYTE, surface->pixels );*/
	glBindTexture(GL_TEXTURE_2D, 0);

Thanks

Networking engine for online multiplayer vehicle battle game

10 October 2009 - 06:39 AM

The title says it all. I'm looking for a networking engine for an online multiplayer vehicles battle game (not massive, up to ~30 players perhaps). The most important feature is a decent client side prediction since its a physics game. Any suggestions?? Thanks in advance.

If(...) return inside void functions/methods

13 April 2009 - 08:24 AM

What do you think about
void f(int x)
{
    if(x > 10)
        return;

    //Do something. . . 
    //.  . .. .. . .... . .    . . 
}

? (no specific language)

Algorithm to compute minimum translation vector to separate shapes

04 April 2009 - 06:37 AM

I'm in the need of an algorithm to compute the minimum translation vector that will separate one shape from n shapes, so that after the translation, there's no intersection. Assume we have n shapes in a region and there's no intersection among these. Then I want to insert a new shape at a position p. If it doesn't intersect anything its all OK. But if it intersects any other shape, I need to translate it in order to separate them in a way that it will be translated by the minimum possible amount(the direction doesn't matter). I'm working in 2D and only using convex shapes by now. One solution (which I'm sure wont work very well and is probably VERY slow) is to compute the minimum translation vector for lots of different directions and pick the smallest...lol...this seems a hard problem =). Thanks.

PARTNERS