OpenGL with Borland C++ Builder 6.0

Started by
11 comments, last by dynamo_wku 20 years, 5 months ago
Just an update here. I was experimenting with the ScanLine function in Borland and I ended up loading the texture BUT, the color is wrong on the "NeHe.bmp" from Lesson 6 and I tried loading the "Crate.bmp" from Lesson 7 and it looks nothing like a crate. So I''m guessing it was a coincidence that the NeHe bitmap worked somewhat OK.

Here''s the code for my glTexImage2D():
Graphics::TBitmap* TextureImage[1];TextureImage[0] = new Graphics::TBitmap;TextureImage[0]->LoadFromFile("NeHe.bmp");...glTexImage2D(GL_TEXTURE_2D, 0, 3,   TextureImage[0]->Width,   TextureImage[0]->Height, 0, GL_RGB, GL_UNSIGNED_BYTE,   TextureImage[0]->ScanLine[TextureImage[0]->Width-1]);
Advertisement
Just a guess but your colours may be screwy due to the BGR format TBitmap uses...

Also, be careful with codeguard. It doesn''t play well with GL
and can AV in the most obscure places. I haven''t had any trouble with VCL and GL though.
What is codeguard?

Also, here is my code for converting BGR to RGB using a TBitmap in Borland. The NeHe bmp from lesson 6 is no longer orange for me but it isn''t blue either. It''s green now Also, the crate image from Lesson 7 shows up like a crate now so I must be on the right path but it''s not really brown. It''s more purple or something. So what am I doing wrong?

   img->PixelFormat = pf24bit;   // convert to 24 bit image   unsigned char* ptr;   unsigned char tempRGB;   for(int y = 0; y < img->Height; y++) {      ptr = (char *)img->ScanLine[y];      for(int x = 0; x < (img->Width*3)-2; x++) {         tempRGB = ptr[x];         ptr[x] = ptr[x+2];         ptr[x+2] = tempRGB;      }   }


I figured this would change my color scheme from BGR to RGB but it''s not working properly.

This topic is closed to new replies.

Advertisement