Jump to content
  • Advertisement

Archived

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

Kiroke

Another Newby question...

This topic is 6031 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 all again. i got some problems with my first attempting to code in openGL. I''ve printed the tutorial 7 code and tried to type it(wanted to look at every line to be sure i understand), so they might be some errors somwhere. The part ive really changed is the GrawGLScene fonction int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(0.0f, 1.0f, 0.0f); //oeil haut gauche glLoadIdentity(); glTranslatef(-2.0f, 4.0f, -45.0f); glBegin(GL_QUADS); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f); glEnd(); //bouche bas glLoadIdentity(); glTranslatef(0.0f, -7.0f, -45.0f); glBegin(GL_POLYGON); glVertex3f(0.0f, 0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 0.0f); glVertex3f(-1.0f, 2.0f, 0.0f); glVertex3f(1.0f, 2.0f, 0.0f); glVertex3f(1.0f, 1.0f, 0.0f); glEnd(); //plaquette glColor3f(0.0f, 0.0f, 1.0f); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -45.5f); glBindTexture(GL_TEXTURE_2D, texture[0]); glBegin(GL_QUADS); glNormal3f(0.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-5.0f, -10.0f,0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-5.0f, 10.0f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(5.0f, 10.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(5.0f, -10.0f, 0.0f); glEnd(); return TRUE; } The problem is : The texture wont load on the quad called "plaquette". I got no error message(i guess the texture loaded all well and that LoadGLTexture and LoadBMP did their job). I''ve putted the Texture in the right place and it should be loaded. Now, im almost sure i did a newby error in that code so im asking u experimented guys to help me a little:-) Kiroke PS: by the way i appreciated alot the help u gave me.. i think i couldnt make it without this forum...thx alot

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
actually, newbie

Share this post


Link to post
Share on other sites
mmm it doesnt seem to works... in the NeHe tutorial 7 glEnable is in the InitGL()

ive tried to put in the enable and the disable : no error message but still no texturing.

Thx anyway

Kiroke the NewbEE :-)

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
actually, newbie

Yeah, it figures I''d make a typo in a spelling correction . I fixed my post.
quote:
Original post by Kiroke
Just thought about somthing...Could it be related to the fact that my Texture is not a square??

How is your texture not a square (I assume it is a 2D texture)? If it''s a rectangle, that''s fine. However, the dimensions (width and height) must be powers of two for some video cards.

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
Unless you''re mipmapping your textures, the sides have to be 2^n long. Like 64*64, 128*128, etc.

I believe you have to set "filter" to 1 or 2 to use mipmapped textures in that tutorial. And you should be able to switch filters while the program is running - by pressing F.

_________
"Maybe this world is another planet''''s hell." -- Aldous Huxley

Share this post


Link to post
Share on other sites
Thx guys!

it works nice with mipmapping... my bmp was a rectangular one so now ill use that. thinking about it...u must always have a square texture when ur not using mipmap textures?? if so, is the only way to apply a texture on a rectangular object is to use a 64*64 bmp and to use glTexCoord2f(0.0f, 0.5f); , for example?

i really like that feeling u get when ur problem is resolved:-)

Kiroke

Share this post


Link to post
Share on other sites
Mipmapping is inefficient (with video memory) unless your texture will be suspended in the Z dimension (that''s a general rule, it doesn''t always apply however). You can use gluScaleImage to do what mipmapping does without the inefficiency in those cases.

About dimensions of images: As long as both sides are powers of 2 it doesn''t matter what size the sides are or if they''re the same. The minimum size length is normally 16 pixels (although it can vary), and the maximum varies a lot with what video card you''re using. Some Voodoo cards have a 256x256 maximum texture size, but most (not all) modern cards go to at least 2048x2048.

[Resist Windows XP''s Invasive Production Activation Technology!]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!