Jump to content
  • Advertisement

CodeBox

Member
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

122 Neutral

About CodeBox

  • Rank
    Member
  1. CodeBox

    transparent textures?

    How Do I set the texture as RGBA?
  2. I have got textures on my program but I can't figure out how to make the white bits of the textures transparent? Here is some of my code just encase you need it! GLuint LoadTexture(char *filename) { GLuint texID; AUX_RGBImageRec *image = auxDIBImageLoad(filename); glGenTextures(1, &texID); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, image->data); return texID; } static void instructionsBackground(){ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, waterId); glBegin(GL_QUADS); glColor3f(1,1,1); glTexCoord2f(10.0f, 10.0f); glVertex2d(winL,winT); glTexCoord2f(10.0f, 0.0f); glVertex2d(winL,winB); glTexCoord2f(0.0f, 0.0f); glVertex2d(winR,winB); glTexCoord2f(0.0f, 10.0f); glVertex2d(winR,winT); glEnd(); }
  3. CodeBox

    textures??

    I get ya it's working fine now! I added void imageInit(void) put all the variables in there. E.g orangeBuildingId=LoadTexture("water.bmp"); then called it in the same place as the init and it works fine now!
  4. CodeBox

    textures??

    Erm.. could you expand on that Trienco I not getting what you mean? am I not placing code in correct place or setting variables up right? can you expand on what igzacly am doing wrong?
  5. CodeBox

    textures??

    this just gives it a tile affect but even so I have other textures with 1.0 that would work if that was the problem! it works when I put glBindTexture(GL_TEXTURE_2D, LoadTexture("water.bmp")); instead of the variable but then it then is not a pointer to it and there for it gets drawed several times and the memory fails!
  6. CodeBox

    textures?

    I just see a white quad and my dimaentions are of the powers you said and in the same folder too! I tried doing what you said but am not really sure where you are meant to put the code although I tried several places with the code you said glfrontface and nothing happened, I also tried to call to glEnable(GL_TEXTURE_2D) at the top of the LoadTexture() function, but again just white quad? any ideas?
  7. CodeBox

    textures??

    Ok I have the code below and it does not seem to be working! I don't know why it compiles but the images don't show on screen and I just see a white quad, can any one tell me what I am doing wrong? My texture dimensions are (64x64, 128x128), so thats not a problem! GLuint LoadTexture(char *filename) { GLuint texID; AUX_RGBImageRec *image = auxDIBImageLoad(filename); glGenTextures(1, &texID); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, image->data); return texID; } GLuint waterId=LoadTexture("water.bmp"); GLuint redBuildingId=LoadTexture("orangebuild.bmp"); GLuint blueBuildingId=LoadTexture("water.bmp"); GLuint orangeBuildingId=LoadTexture("water.bmp"); static void background(){ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, waterId); glBegin(GL_QUADS); glColor3f(1,1,1); glTexCoord2f(10.0f, 10.0f); glVertex2d(winL,winT); glTexCoord2f(10.0f, 0.0f); glVertex2d(winL,winB); glTexCoord2f(0.0f, 0.0f); glVertex2d(winR,winB); glTexCoord2f(0.0f, 10.0f); glVertex2d(winR,winT); glEnd(); }
  8. CodeBox

    textures?

    Ok I have the code below and it does not seem to be working! I don't know why it compiles but the images don't show on screen can any one tell me what I am doing wrong? GLuint LoadTexture(char *filename) { GLuint texID; AUX_RGBImageRec *image = auxDIBImageLoad(filename); glGenTextures(1, &texID); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, image->data); return texID; } GLuint waterId=LoadTexture("water.bmp"); GLuint redBuildingId=LoadTexture("orangebuild.bmp"); GLuint blueBuildingId=LoadTexture("water.bmp"); GLuint orangeBuildingId=LoadTexture("water.bmp"); static void background(){ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, waterId); glBegin(GL_QUADS); glColor3f(1,1,1); glTexCoord2f(10.0f, 10.0f); glVertex2d(winL,winT); glTexCoord2f(10.0f, 0.0f); glVertex2d(winL,winB); glTexCoord2f(0.0f, 0.0f); glVertex2d(winR,winB); glTexCoord2f(0.0f, 10.0f); glVertex2d(winR,winT); glEnd(); }
  9. CodeBox

    textures?

    Ok, I closed and re-opened it and I don't get one error now? stupid Visual weired studio??? but there is still a problem if I have glColor3d(1,1,1); or any colour before the image it ever makes it darker or changes it really strange? Edit* attually it has nothing to do with that at all I had some old code and it was not doing it via the way you said anyways iyt does not seem to be working just brings up the default colour I had before? You think I should put the GLuint variables in the init or idle? it's p**sing me off now!!! I put them global and nothing I put them in the same file hey then bang wam slow down of the centry and poo and memory fails haha, so why when I put this outside the void do them not show? GLuint redBuildingId=LoadTexture("redbuild.bmp"); GLuint blueBuildingId=LoadTexture("bluebuild.bmp"); GLuint orangeBuildingId=LoadTexture("orangebuild.bmp"); * [Edited by - CodeBox on November 29, 2005 10:53:23 PM]
  10. CodeBox

    textures?

    What like this? If I put the GLuint below the variables it goes nuts and brings up loads of errors and at the memont I get this error? go fatal error LNK1201: error writing to program database 'c:\Documents and Settings\Stephen Kelly\My Documents\uni work\programming\Gorillas\go\Debug\go.pdb'; check for insufficient disk space, invalid path, or insufficient privilege GLuint LoadTexture(char *filename) { GLuint texID; AUX_RGBImageRec *image = auxDIBImageLoad(filename); glGenTextures(1, &texID); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, image->data); return texID; } GLuint waterId=LoadTexture("water.bmp"); GLuint redBuildingId=LoadTexture("orangebuild.bmp"); GLuint blueBuildingId=LoadTexture("water.bmp"); GLuint orangeBuildingId=LoadTexture("water.bmp"); Edit* I had a quick look but it just confused me the black background don't help neither, (i am dyslexic you see) *
  11. CodeBox

    textures?

    OK, cool I did that I think i'll do it again now, but I did it and it was giving me an error one sec it will take me two mins to do that! Thanks for helping! P.s what variable formate is best? int? double? char?
  12. CodeBox

    textures?

    ok, I got this on a tutorial and I did not really understand it. it draws like 30 images every frame I guess how do I stop this? what is the render function?
  13. CodeBox

    textures?

    I have this code for my textures but if I use 30 textures at once then the computer runs out of memory, or says DIB convertion error or something! I was wondering if there was a better way or some code to stop this? Code below! Thanks for any help in advance! GLuint LoadTexture(char *filename) { GLuint texID; AUX_RGBImageRec *image = auxDIBImageLoad(filename); glGenTextures(1, &texID); glBindTexture(GL_TEXTURE_2D, texID); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE, image->data); return texID; } static void background(){ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, LoadTexture("water.bmp")); glBegin(GL_QUADS); glColor3f(1,1,1); glTexCoord2f(10.0f, 10.0f); glVertex2d(winL,winT); glTexCoord2f(10.0f, 0.0f); glVertex2d(winL,winB); glTexCoord2f(0.0f, 0.0f); glVertex2d(winR,winB); glTexCoord2f(0.0f, 10.0f); glVertex2d(winR,winT); glEnd(); }
  14. dt is not same as timeSinceLaseUpdate! Time since last update is the seconds since the banana was throw runTime might = 33.3, gotTime might = 25.3, therefore timeSinceLastUpdate = 8 seconds timeSinceLastUpdate=(runTime-gotTime) dt is the delta time the time it takes to update a frame I think! dt = systemTime - lastTime; lastTime = systemTime; systemTime may = 10.005 seconds, and lastTime may = 10.002 seconds, meaning it took 0.003 seconds or 3 miliseconds to update the frame?? so thats why I timesed it by this is this correct?
  15. I'm a bit simple I do not quite understand where I run this and I was trying to find out how I make say a ball go accross the screen at the same rate on any computer? E.g ball -----> ball -----> ball -----> ball -----> ball -----> ball -----> ball and it would do this on any computer? edit* this is what I have done! is it right? bananaX += (bananaVelX * timeSinceLastUpdate)*dt; bananaY += (bananaVelY * timeSinceLastUpdate)*dt; bananaVelX += ((wind) * timeSinceLastUpdate)*dt; bananaVelY -= (gravity * timeSinceLastUpdate)*dt; timeSinceLastUpdate=(runTime-gotTime); // no longer divided by 60 I don't have enought computer so I can't check it? :( * [Edited by - CodeBox on November 28, 2005 4:27:15 PM]
  • 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!