Jump to content
  • Advertisement

Archived

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

dynamo_wku

OpenGL OpenGL with Borland C++ Builder 6.0

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

For the most part BCB6 works fine with OpenGL but further into it things might get weird with Borland''s VCL but I will cross that bridge when I get there. My problem is loading textures. I can''t seem to figure out how to load up a bitmap in Borland so that OpenGL''s texture stuff can use it. Any help will be greatly appreciated. Thanks, Abe

Share this post


Link to post
Share on other sites
Advertisement
Yes...I tried but I kept getting this message:

[Linker Error] Unresolved external ''auxDIBImageLoadA'' referenced from C:\PROGRAMMING\BORLAND\GL1\MAIN.OBJ

I looked around and found out that glaux is not available in Borland because of its VCL that has all that you need for things like this. But I just started with Borland so I''m not familiar with it much.

Abe

Share this post


Link to post
Share on other sites
I can see two relatively easy options:

Option 1: Go to nehe.gamedev.net, browse over to lesson number 6, scroll down to the bottom and grab the Borland C++ Builder 6 source code. That includes the glaux.lib file you need to link against to use GLaux.

Option 2: Use glut. You can either download a binary or source code and compile yourself.

Share this post


Link to post
Share on other sites
Good idea I went and grabbed the glaux.lib and added it to my project. The error is gone but now there is a new link error

[Linker Error] Unresolved external ''_tkPopupEnable'' referenced from C:\PROGRAMMING\BORLAND\GL1\GLAUX.LIB|Tkimage

I''m going to copy and paste the code needed to load the images from tutorial 6 and see what that does...

Thanks,

Abe

Share this post


Link to post
Share on other sites
I changed the LoadBMP function so that it would work with Borland...This new way should be totally legal. What do you think?


AUX_RGBImageRec* Tform_Main::LoadBMP(AnsiString Filename) // Loads a bitmap image

{
if (FileExists(Filename))
{
return auxDIBImageLoad(Filename.c_str());
}
return NULL;
}


Then for the LoadGLTextures I have kept it totally the same and instead of using global values I just placed them in my TForm''s class so it''s technically a global to anything in my TForm methods. Anyway, this cryptic Link error is still here. I did a search in google and got literally no search results. I''ve never heard of _tkPopupEnable or the Tkimage thing it says.

[Linker Error] Unresolved external ''_tkPopupEnable'' referenced from C:\PROGRAMMING\BORLAND\GL1\GLAUX.LIB|Tkimage

Share this post


Link to post
Share on other sites
You ought to look into DevIL. I downloaded the library and recompiled the ''.lib'' files under BCB 6 and got it to work in Borland. It''s so easy to use and supports all image formats. The only hard part is converting the libs, you have to use one of borland''s utilities in the bin directory.

Share this post


Link to post
Share on other sites
Ok...I have implemented the new function to load the textures using a TBitmap and the ScanLine function associated with the Bitmap. But I can't use the ScanLine directly. Do I need to loop through the bitmap and store the pixels in something then pass that to the glTexImage2D? If so how?

The error I get is:
[C++ Error] main.cpp(247): E2193 Too few parameters in call to '_fastcall TBitmap::GetScanline(int)'

But I'm not calling GetScanLine...Any suggestions?

Abe


int Tform_Main::LoadGLTextures() // Load bitmaps and convert to textures

{
int Status = false;

Graphics::TBitmap* TextureImage[1];


TextureImage[0]->LoadFromFile("NeHe.bmp");
if(TextureImage[0]) {
Status = true;
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3,
TextureImage[0]->Width,
TextureImage[0]->Height, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->ScanLine);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}

if (TextureImage[0]) // If texture exists

{
if(TextureImage[0])
TextureImage[0]->ReleaseHandle();
delete TextureImage;
}
return Status; // Return the status


}


[edited by - dynamo_wku on November 6, 2003 2:25:34 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!