Jump to content
  • Advertisement

Archived

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

a problem with pointers

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

I am trying to do a class wich I can use to load my textures in OpenGL, I got everthing working exept when I whant to store the bitmap in AUX_RGBImageRec *TextureImage wich I have used new on to create an array of those. how would I do this?
//..code	

	AUX_RGBImageRec *TextureImage;

	TextureImage = new AUX_RGBImageRec [n];


	memset(TextureImage, 0, sizeof(void *)*n);
	
	for(int x = 0; x<n; x++)
	{
                //This does not work apparantly

		if(TextureImage[x]=this->LoadBMP(mFilename[x].c_str()))
		{
			status=true;

			glGenTextures(1, &mTexture[x]);
			
//..code

[edited by - kappa on March 27, 2004 11:42:49 AM]

Share this post


Link to post
Share on other sites
Advertisement
I don''t have but a moment to look at it but I think you have to do this... try changing this:


AUX_RGBImageRec *TextureImage;
...
//This does not work apparantly
if(TextureImage[x]=this->LoadBMP(mFilename[x].c_str()))


to


AUX_RGBImageRec *TextureImage;
...
//This does not work apparantly
if(TextureImage[x]=(*AUX_RGBImageRec)this->LoadBMP(mFilename[x].c_str()))


-Greven

Share this post


Link to post
Share on other sites
Ok...TextureImage should be a pointer right? so you need a pointer to a pointer instead so you want this...

AUX_RGBImageRec **TextureImage;

TextureImage = new AUX_RGBImageRec*[n];

You should keep in mind OpenGL doesn't store the actual pointer you are using, it keeps an identifier to the image



[edited by - PatrickD on March 27, 2004 12:55:17 PM]

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!