Archived

This topic is now archived and is closed to further replies.

Skybox problem!

This topic is 5936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I am doing, my first game, a 3D shooter, bla,bla and I came to the point where I need a skybox. Well, I robbed a game it''s skybox (where it looked great, unfortunately I don''t have the game''s code) and I used those pics in my little game. My problem is that if I fit those textures on a cube(with only 5 faces, TOP, FRONT, LEFT, RIGHT, BACK), I get some strange lines between them. If I get the pics and if I stick them together in msPant, they fit and look good.I believe I have to do something with the code, so help please! You can look at some screenshots and at the code I use at www.cavendish.home.ro.

<-- smile :-)

Share on other sites

void CreateTexture(UINT textureArray[], LPSTR strFileName, int textureID){  AUX_RGBImageRec *pBitmap = NULL;  if(!strFileName)									     return;  pBitmap = auxDIBImageLoad(strFileName);  if(pBitmap == NULL)    exit(0);  glGenTextures(1, &textureArray[textureID]);  glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);  if (pBitmap)  {    if (pBitmap->data)        free(pBitmap->data);    free(pBitmap); }}

RipTorn, I can't find GL_WRAP here.

[edited by - cavendish on September 15, 2002 5:41:46 AM]

Share on other sites

  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);

GL_LINEAR_MIPMAP_LINEAR is not a valid magnification filter. Only GL_LINEAR and GL_NEAREST are valid.

Anyways, try put these two lines in your code. This is what RipTorn was talking about.

  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

Share on other sites
Wow!!!
Thanks Brother Bob, RipTorn!!!!
It looks super!!!
Who thought I can solve my problem in 30min after 5 hours of veryfing .....
Thanks!!

Share on other sites
Using GL_CLAMP will make lines appear just the way you described in non-nvidia cards.

The proper way, as someone suggested, is to use GL_CLAMP_TO_EDGE.
It's not part of OpenGL 1.1 but all major cards support this extension.

  #define GL_CLAMP_TO_EDGE 0x812F

The reason it works in nvidia cards is because they make GL_CLAMP act like GL_CLAMP_TO_EDGE, but they're different things. Anyway, there's some option in the new drivers that make it work properly.

[edited by - t0y on September 15, 2002 10:44:30 PM]

Share on other sites
t0y: you''re absolutely right ! For more informations on clamping textures, read the short note that Patrick Brown (one of the driver developers from NVIDIA) wrote on OpenGL.org Discussion & Help Forums.
Though you have to know that GL_CLAMP_TO_EDGE is not supported by OpenGL1.0, that is you MAY not be able to use it on a few cards. As a positive note, almost all cards support it today.
You can find a non-exhaustive list of cards that support the extension GL_SGI_texture_edge_clamp, GL_SGIS_texture_edge_clamp and GL_EXT_texture_edge_clamp. All those extensions allow the usage of GL_CLAMP_TO_EDGE.

Share on other sites
hmm. well. I''ve seen cases where CLAMP_TO_EDGE badly corrupted the textures... where GL_CLAMP didn''t.. but that was on a fairly dodgy laptop...

<-- smile :-)

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633742
• Total Posts
3013636
×

Important Information

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!