Jump to content

  • Log In with Google      Sign In   
  • Create Account

Somone else

Member Since 24 May 2012
Offline Last Active Dec 04 2012 07:07 AM

Topics I've Started

ilutGLBindTexImage creates a 1*1 texture

23 August 2012 - 02:46 AM

I have been trying to solve this for some time, but after googling and googling, again ang again. I finally decided to post it here.
I use the following code to load a texture into OpenGL, using DevIL:
bool CImage::Load(const std::string &File){
	ILuint Image;
	if(ilGetInteger(IL_IMAGE_ORIGIN) == IL_ORIGIN_LOWER_LEFT) iluFlipImage();
	Tex = ilutGLBindTexImage();
	Width = ilGetInteger(IL_IMAGE_WIDTH);
	Height = ilGetInteger(IL_IMAGE_HEIGHT);
	int W,H;
	return Tex != 0;
My problem is that after the texture is loaded, it only has a size of 1*1 ie. one pixel, which it 512 times smaller than the actual image.
The pixel is the same color as the top left pixel in the actual image, so I know that some of the data is loaded.

If you want you can download the code here, and check it out: Attached File  Engine.zip   461.47KB   76 downloads

PS: I don't know if this fits in this forum. It kind of has to do with OpenGL, and kind of doesn't.

glTexImage2D does nothing

24 May 2012 - 08:14 AM

I'm using SDL_image to load textures for my game, I then try to load them into OpenGL using glTexImage2D.

Using the following code I've found out, that the problem lies in glTexImage2D, as it simply does nothing. (at least the width and height of the texture remains unchanged)
int ID,Width,Height;


std::cout << ID << ": " << Width << "*" << Height << std::endl;

The weird thing is that I have another program, and it uses the exact same code, but it works in that program.

glGetError returns 0 ie no error.

The code loading the texture and all is compiled and linked into a static library, and I have a test project that links with it, so I can see, if the code I've written works or not.