Archived

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

Lesson6 - Texture Mapping :)

This topic is 5587 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

My problem is, when I try to compile i get an error in the following section of the code: "[Warning] In function `int LoadGLTextures()'': 78 implicit declaration of function `int free(...)'' [Build Error] [main.o] Error 1"
  
int LoadGLTextures()					
{
	int Status=FALSE;

	AUX_RGBImageRec *TextureImage[1];					
	memset(TextureImage,0,sizeof(void *)*1);           	
	
	if (TextureImage[0]=LoadBMP("Data\NeHe.bmp"))
	{
		Status=TRUE;					

		glGenTextures(1, &texture[0]);			

                glBindTexture(GL_TEXTURE_2D, texture[0]);
                glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
         if (TextureImage[0])					
	 {
		if (TextureImage[0]->data)			
		{
			free(TextureImage[0]->data);		
		}

		free(TextureImage[0]);					 }

	return Status;					
}
  
im using dev-cpp..

Share this post


Link to post
Share on other sites
oh darn it..

now what do i do to fix:

[Linker error] undefined reference to `auxDIBImageLoadA@4''
[Linker error] undefined reference to `glGenTextures@8''
[Linker error] undefined reference to `glBindTexture@8''
[Linker error] undefined reference to `glTexImage2D@36''
[Linker error] undefined reference to `glTexParameteri@12''
[Linker error] undefined reference to `glTexParameteri@12''
[Linker error] undefined reference to `glViewport@16''
[Linker error] undefined reference to `glMatrixMode@4''
[Linker error] undefined reference to `glLoadIdentity@0''
[Linker error] undefined reference to `gluPerspective@32''
[Linker error] undefined reference to `glMatrixMode@4''
[Linker error] undefined reference to `glLoadIdentity@0''
[Linker error] undefined reference to `glEnable@4''
[Linker error] undefined reference to `glShadeModel@4''
[Linker error] undefined reference to `glClearColor@16''
[Linker error] undefined reference to `glClearDepth@8''
[Linker error] undefined reference to `glEnable@4''
[Linker error] undefined reference to `glDepthFunc@4''
[Linker error] undefined reference to `glHint@8''
[Linker error] undefined reference to `glClear@4''
[Linker error] undefined reference to `glLoadIdentity@0''
[Linker error] undefined reference to `glTranslatef@12''
[Linker error] undefined reference to `glRotatef@16''
[Linker error] undefined reference to `glRotatef@16''
[Linker error] undefined reference to `glRotatef@16''
[Linker error] undefined reference to `glBindTexture@8''
[Linker error] undefined reference to `glBegin@4''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glTexCoord2f@8''
[Linker error] undefined reference to `glVertex3f@12''
[Linker error] undefined reference to `glEnd@0''
[Linker error] undefined reference to `wglMakeCurrent@8''
[Linker error] undefined reference to `wglDeleteContext@4''
[Linker error] undefined reference to `wglCreateContext@4''
[Linker error] undefined reference to `wglMakeCurrent@8''

:|

Share this post


Link to post
Share on other sites
those would be

#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>

and they're allready included

i've also got

-lopengl32 -lglu32 -lglaux

under "Linker options/Optional libs or object files"
in my project options.


Im almost certain that i've set the project up correctly, but if anyone want to contribute and help me learn opengl, i'd like a complete walkthrough of everything needed to set up an opengl program.
(im using dev-cpp therefore it has to be a walkthrough which fits dev-cpp)

[edited by - sh0rtaaay on August 29, 2002 12:35:34 PM]

Share this post


Link to post
Share on other sites
You need to have the Glaux.dll in the same directory of your project and Exe. There are some problems with Glaux no being suported anymore ar something like that. you can still use it on Dev-C++, but you will need to download the glaux DLL (1,32Mgs), and distribute it with your game. This is why many people prefer to write their own bitmap Loading function (see NeHe Lesson24, he loads a TGA file, but you can try to modify it to a BMP), but that''s something that will take some time.

I can e-mail the dll for you if you want to (or my bmp loader, but my bmp loader has poor comenting, leeks memory and doesen''t always work. It will load bmps however...).

Share this post


Link to post
Share on other sites
quote:
Original post by sh0rtaaay
Im almost certain that i''ve set the project up correctly, but if anyone want to contribute and help me learn opengl, i''d like a complete walkthrough of everything needed to set up an opengl program.
(im using dev-cpp therefore it has to be a walkthrough which fits dev-cpp)


Looks like you already have the appropriate things set up...

|.dev-c++.|.the gimp.|.seti@home.|.try2hack.|.torn.|

Share this post


Link to post
Share on other sites
thx algumacoisaqualquer.. but actually.. those linker errors were because of a bug in Dev-cpp. It''s fixed now.
Tho you are right about the thing that i need glaux.dll
I don''t want your bitmap loader, but i would like some info(tutorial) on how to make one of these, NOT using glaux.

Share this post


Link to post
Share on other sites
Ok, here is how I did it:

1) Take a look at NeHe''s Lesson24, it loads a *tga file, learn how it works, it can look hard at first, but it''s not.

2) Get the bmp file format at http://www.wotsit.org, take a look. I sugest that you download Hex Workshop at http://www.bpsoft.com, this is a program that opens any file in it''s binary format, very useful to understand how the data storage works. It''s shareware, but you can use it for 30 days, that will be a lot more than you need.

3) Mix them up and cook for 1 hour. basicly, in the TGA load thing, he takes the image height, width, bites per pixel, and the start of the pixels array. For 24bits bitmaps, you are going to do the same, the only difirence will be the position of this informations, in the TGA you use height = buffer[4], and in BMP you use height = buffer[10], (not the actual posicions, but you get the idea). For paleted bitmaps, you will also have to deal with the palete, but it''s not that hard.

Share this post


Link to post
Share on other sites