Jump to content

  • Log In with Google      Sign In   
  • Create Account


glTexImage2D gives 'invalid value' error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 gimp   Members   -  Reputation: 142

Like
Likes
Like

Posted 08 October 2001 - 12:00 AM

I''ve been having some problems with getting some of my tga images to be be created as textures. I naturally though there was something wrong with my code so I created a hard coded call to the api and that failed too: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 640, 128, 0, GL_RGB, GL_UNSIGNED_BYTE, a_Image.GetData()); My card supports 2048x2048 textures. Size of my image data array is 640*128*3 bytes. The funny thing is, when you call gluBuild2DMipmaps with the same data(args differ a little) the texture creation works fine. Which leads me to two possible conclusions: 1) gluBuild2DMipmaps is smarter and fixed some error I''m making. 2) The difference in args is the key. 2 seems more plausable so I check and rechecked the args. they look good to me... Any thoughts much appreciated... Many thanks Chris Brodie http:\\fourth.flipcode.com

Sponsor:

#2 MButchers   Members   -  Reputation: 123

Like
Likes
Like

Posted 08 October 2001 - 01:06 AM

Hi there,

the problem is you are passing a rectangular ( not square )
image, all opengl textures need to be to the power of 2 and
square ( although i believe there are extensions to support
rectangular textures ).

The reason why it works with gluBuild2DMipmaps is that
this scales the image so it is square ( from what I can
gather from the red book ).

Hope it helps

Mark

#3 MENTAL   Members   -  Reputation: 382

Like
Likes
Like

Posted 09 October 2001 - 11:39 PM

hmm... i never knew they textures had to be square. afaik, all they had to have is a height and a width that is a power of 2.

MENTAL




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS