Advertisement Jump to content
  • Advertisement

Scarfy

Member
  • Content Count

    133
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Scarfy

  • Rank
    Member
  1. I'm using glBlendFunc(GL_DST_COLOR, GL_ONE) to create some lighting effects in my game 2D game. I first draw the entire scene, then fade it depending on the light level I want, and finally add in some textures using the above function to create torch-like effects. It works well, except for when a number are grouped together. The multiple layering and multiplication of the destination colours means that that part of the scene becomes overly bright and washed out. Is there a way that I can clamp the result of the multiplications so that they only become so bright? Hope that makes sense.
  2. Hi All, Just wanted to say that Blob Wars : Blob and Conquer v0.92 is now available. Source and Linux binaries (Deb and RPM) have been uploaded. Changes include, * Real time cutscenes (some are still quite rough around the edges) * Items should no longer become stuck in walls * Teeka can no longer die. He will teleport away if his energy hits 0. * Teeka and the other blobs are more aggressive when they fight * The game automatically pauses if focus is lost (e.g. a screensaver comes on) * Misc. changes to the maps * Misc. changes to fix bugs * Some extra hints for boss battles (eg - in the Crypt) You can get it from, http://www.parallelrealities.co.uk/blobAndConquer.php
  3. I've decided to go with TGAs instead to deal with this issue... It'll be quicker than spending hours trying to work out what's wrong with my PNGs Ta :)
  4. Nope. No joy just yet. Just to show you what's going on I've included some images, This is the result of glEnable(GL_BLEND) This is the result of glDisable(GL_BLEND) This is the result of glEnable(GL_BLEND) with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); set. And here's how the image appears in Gimp. Is it actually possible to have just the solid colours of the icons with the alpha background ignored when I build the texture? I've no idea what I'm doing wrong.
  5. Shows as a transparent PNG in GIMP. I basically take my image, add an Alpha Channel in Gimp and then clear the areas that I wish to be transparent. I'll have a play around though and see what I can do.
  6. Here's my code... In case you can see what I'm doing wrong, OpenGL Texture creation, Texture *Graphics::createTexture(SDL_Surface *surface) { int w = Math::toNextPower(surface->w, 2); int h = Math::toNextPower(surface->h, 2); SDL_Surface *tmp = createSurface(w, h); SDL_BlitSurface(surface, NULL, tmp, NULL); GLuint glTexture; glGenTextures(1, &glTexture); glBindTexture(GL_TEXTURE_2D, glTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmp->pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, tmp->w, tmp->h, GL_RGBA, GL_UNSIGNED_BYTE, tmp->pixels); Texture *texture = new Texture(); texture->data = glTexture; texture->iw = surface->w; texture->ih = surface->h; texture->tw = tmp->w; texture->th = tmp->h; SDL_FreeSurface(tmp); SDL_FreeSurface(surface); return texture; } SDL Surface creation, SDL_Surface *Graphics::createSurface(int width, int height) { SDL_Surface *surface; Uint32 rmask, gmask, bmask, amask; /* SDL interprets each pixel as a 32-bit number, so our masks must depend on the endianness (byte order) of the machine */ #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; #else rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; #endif surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, rmask, gmask, bmask, amask); if (surface == NULL) { showErrorAndExit("CreateRGBSurface failed: %s\n", SDL_GetError()); } return surface; } Finally the texture is rendered using GL_BLEND enabled. Any ideas what's wrong..? The sprites are not to the power of 2 which is why I need to create a bigger surface to put them on. Think that's causing issues? Cheers.
  7. I'm attempting to use transparent PNGs as sprites for a game. However I cannot get SDL or OpenGL to ignore the alpha channel. I either end up with black backgrounds or I have to use glEnable(GL_BLEND) that makes my sprites blending in to the scenery. Anyone have any code for handling transparent PNGs..?
  8. I'm currently working on a 3rd person action game and right now the game supports a method of auto aiming where targets are automatically chosen for the player. All the player needs to do is fire and move around. However I want to add in manual aiming and although I've tried it before I never quite got it right. To determine the direction and vector for the bullets should I aiming for the horizon or reading the z value of screen pixels to determine where the shot should go? (hope that makes sense). I found the z value to work in most situations but it didn't work when transparent pixels came in to play. How should it be done? Cheers
  9. "You might consider a grid as opposed to a quadtree." Cheers, guys. Sounds like a quadtree could get nasty. I did do a grid once before but I messed it up. However I think I'll be able to do it right this time. Incase you're wondering what I did wrong, Imagine my object is, in cells, 4 x 4. I was only adding the object to the cells which its corners lay (if that makes sense). I'll do a proper fix this time Thanks!
  10. I'm trying to use quadtrees for collision detection. Could someone help me with adding objects to Quadtrees? I understand how to create one and have done so, but I'm having problems understanding dealing with the process of adding things too it. Assuming my smallest cell is 64 x 64 and the size of the object I wish to add is 32 x 32 I can happily add it to the cell. However what happens if the object's coordinates make it straddle two or four cells? Do I add it to these cells? What happens if the object is too big to be added to the smallest cell? Do I go to the next cell up..? What happens if the object lies exactly in the center of the quadtree? Does that mean it could potentially collide with everything in the game world..?
  11. Scarfy

    BSP Collision Issues

    I've sort of solved the issue. I say sort of because it's a nasty hack, After I have finished the movement I then lift the entity upward by EPSILON. I then trace down by a small amount (0.5 in my case). If the trace fails it has hit the ground and I then tell my object it is infact on the ground. It sounds horrible but it doesn't have any adverse effects. Not elegant but it works.
  12. Scarfy

    BSP Collision Issues

    I've been doing some more work on this and I think it may be due to the objects at some point lying exactly on the plane. I'm guessing I should move they a little away from the plane that they have hit as CadeF suggested. The response repositions the objects and also changing their velocity according to whether they slide or not. The collision detection does this, Removes the OnGround flag Starts up a while loop Adds +EPISLON or -EPSILON as needed to the tracer end point if the velocity is not 0 Sets the position of the object to the position of the current trace Performs a slide or a bounce if needed Removes the added EPSILON if the outputFraction is 1.0 Exits if the outputFraction < 1 If you want to see code, just ask.
  13. Scarfy

    BSP Collision Issues

    Hi, Could you do so..? That would be great... :)
  14. Cheers for that, Anon. I was looking at a few PS2 games the other night and noticed how they do it and it sounds a lot like your idea. I've decided against the transparency thing since it can have poor side effects like revealing the outside of the game world... :|
  15. Scarfy

    BSP Collision Issues

    Collision detection is fine perfect horizontal and vertical surfaces. I guess I should google for it a bit more... collision detection was put together from tutorials so I'm guessing they're not perfect.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!