Sign in to follow this  

glGenTextures does not work anymore

This topic is 3318 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 created a file identifier for a texture with this function:
inline bool LoadTexture (const char *filename, GLuint &textureID, int wrap = 0)
	fipImage fimage;
	if(fimage.load(filename) ) {
		float fWidth = fimage.getWidth(); float fLength = fimage.getHeight();

		glGenTextures (1, &textureID);
		std::cout<<"Textur ID: "<<textureID<<std::endl;
		glBindTexture (GL_TEXTURE_2D, textureID);
		std::cout<<"Texture binded"<<std::endl;

		if(fimage.getImageType() == FIT_BITMAP) {
// ....
but if i try to load bitmaps using in main() nothing works:

	GLuint up; LoadTexture("/home/Xerces/devel/engine_0.4/bin/sky/up.bmp", up);
	GLuint left; LoadTexture("/home/Xerces/devel/engine_0.4/bin/sky/left.bmp", left);
	GLuint mid; LoadTexture("/home/Xerces/devel/engine_0.4/bin/sky/mid.bmp", mid);
	GLuint right; LoadTexture("/home/Xerces/devel/engine_0.4/bin/sky/right.bmp", right);
	GLuint beh; LoadTexture("/home/Xerces/devel/engine_0.4/bin/sky/beh.bmp", beh);
	GLuint down; LoadTexture("/home/Xerces/devel/engine_0.4/bin/sky/down.bmp", down);
this is a part of the draw() function
	// Store the current matrix
	// Reset and transform the matrix.
	glRotatef(-m_pParentGraph->GetCamera()->m_pitch, 1.f, 0.f, 0.f);
	glRotatef(-m_pParentGraph->GetCamera()->m_head, 0.f, 1.f, 0.f);

	// Enable/Disable features

	// Common Axis Z - FRONT Side
	// Render the front quad
	glBindTexture(GL_TEXTURE_2D, m_iSkyBoxT[0]);
	glTexCoord2f(0, 0); glVertex3f(  0.5f, -0.5f, -0.5f );
	glTexCoord2f(1, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
	glTexCoord2f(1, 1); glVertex3f( -0.5f,  0.5f, -0.5f );
	glTexCoord2f(0, 1); glVertex3f(  0.5f,  0.5f, -0.5f );
the most stupid thing is, that the same code works in an other program? i dont know what is wrong... if i check the value of the identifier the value is curios. for example >1000000000 or zero?!

Share this post

Link to post
Share on other sites
Sign in to follow this