Jump to content
  • Advertisement

Archived

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

RIDE

question to glut.h

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

hi, (I''m from germany, so my english is not so good) i have a question about the glut.h header file,... my linker is saying by all glut-commands: (for example) undefined reference to ''glutCreateWindow()'' i have included the libglut.a library, but it doesn''t work! (dev cpp compiler) what must i do, that my linker know the glut commands? ok, i have another question: i want to including a texture, the code is right and my compiler or linker gives me no errermessage - it makes the program.exe but on the object, that should be textured is not any texture! only the color i have given in the glColor3f(..) command... i tryed it by one of my friends and there it has worked... i couldn''t understand it! thx for help, cu

Share this post


Link to post
Share on other sites
Advertisement
I don''t used devcpp so I can''t answer the first one. If you''re including the library file to your project then it should link without problems.

As for the texturing problem, though: is the texture a power of two and why are you so sure your code works.

Output the texture Id OpenGL gives you when you create the texture - if it''s > 0 then everything went well.

If that doesn''t help, is texturing enabled (glEnable(GL_TEXTURE_2D)), is the texture bound (glBindTexture(GL_TEXTURE_2D, TexID)) and are you specifying texture coordinates per-vertex (glTexCoord2f(x, y))?

If none of that fixes the problem, try posting some code.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
-lglut

Share this post


Link to post
Share on other sites
ok,thx for your help...

@Crispy: the code works, but when i compile it on my computer, the texture is not shown, on the computer from my friend it workes... i don''t know why and i think, if the code would be false, it doesn''t work on both computers.

@anonymous_Poster: this is a good idea, i try it immediately.

thx for all!

Share this post


Link to post
Share on other sites
hmm - in that case, what graphics card do you have and what drivers do you have installed?

let me get this straight, though: you compile the project on your computer, on your computer there are no textures, but on your friend''s computer there are?

did you check if the textures are valid on both computers. use the method described in my previous post or call glIsTexture() on the returned texture id after you''ve finished creating it.

Share this post


Link to post
Share on other sites
ok, my operating system: windows xp
operating sytem my friend use: windows 2000

and the bitmap is .bmp on both computers

graphics card (my): Nvidia Riva TNT 2 Model64/Model64 pro
driver (my): driver from Nvidia, version: 4.4.0.3

code: (it is from this page (lesson_06))

#header-files
.
.
.

GLuint texture[1];

AUX_RGBImageRec *LoadBMP(char *Filename)
{
FILE *File=NULL;

if (!Filename) {
return NULL; }

File=fopen(Filename,"r");
if (File) {
fclose(File);
return auxDIBImageLoad(Filename); }

return NULL;

}


//win-main (function)
.
.
.

open-gl-code:

//opengl setup
glEnable(GL_TEXTURE_2D);
.
.
.



AUX_RGBImageRec *TextureImage[1];
memset(TextureImage,0,sizeof(void *)*1);

if (TextureImage[0]=LoadBMP("Data/NeHe.bmp"))
{
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]); }


glBindTexture(GL_TEXTURE_2D, texture[0]);


glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glEnd();

.
.
.

Share this post


Link to post
Share on other sites
hi,

ok, the glut.h problem is solved, it works!!!

but the texture problem is still there... i''m going to try it with another graphics card driver...

ciau, and thx for your helps!!

Share this post


Link to post
Share on other sites
Is your texture size a power of two (like 64X64, or 256X256)? I know that on my GeForce2 (also nVidia) the textures don''t load unless they are a power of 2 (which is the same for most old video cards and even some newer ones).

Share this post


Link to post
Share on other sites
yes, it''s a power of two (256 x 256) ... it''s the bitmap from the lesson six on this page (Nehe.bmp) i know that the code is right, because (i have said it) the texture is shown on another computer, also the problem is my computer... when i have a little bit of time, i''m going to try it with another graphics card driver , probably it could work then (i hope )

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!