Advertisement

Help... lesson 37's generating texture code is broken...

Started by December 01, 2001 06:57 PM
-1 comments, last by BeyondDeath 23 years, 2 months ago
Im trying to use the code from lesson 37 but, i can seem to get the texture code that makes an array zero''s it then generates a texture etc... it doesnt work, I have a particle system in my program and it just ends up looking like the texture from that but stretched all the way accross the screen... The code did work before i put the particle system in.. so without further adeu the code:
  
GLuint EmptyTexture()											// Create An Empty Texture

{
	for(int x=0 ; x< images;x++)
	{
	GLuint txtnumber;
	unsigned int* data;	
// Stored Data


		// Create Storage Space For Texture Data (128x128x4)

		data = (unsigned int*)new GLuint[((128 * 128)* 4 * sizeof(unsigned int))];
	ZeroMemory(data,((128 * 128)* 4 * sizeof(unsigned int)));	// Clear Storage Memory


	glGenTextures(1, &txtnumber);					// Create 1 Texture

	glBindTexture(GL_TEXTURE_2D, txtnumber);			// Bind The Texture

	glTexImage2D(GL_TEXTURE_2D, 0, 4, 128, 128, 0,
		GL_RGBA, GL_UNSIGNED_BYTE, data);			// Build Texture Using Information In data

	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
	delete [] data;							// Release data

	BlurImages[x] = txtnumber;//Array of textures to be used for the effect...

	}
	return 0;						// Return The Texture ID

}
  
I had to stick the gl_clamp in there to fix a problem i was having (earlier post...) Any ideas anyone... THANKS IN ADVANCE!@!

This topic is closed to new replies.

Advertisement