Jump to content
  • Advertisement
Sign in to follow this  
dgrat

glGenTextures does not work anymore

This topic is 3498 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
	glPushMatrix();
	// Reset and transform the matrix.
	glLoadIdentity();
	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
	glPushAttrib(GL_ENABLE_BIT);
	glEnable(GL_TEXTURE_2D);
	glDisable(GL_DEPTH_TEST);
	glDisable(GL_LIGHTING);
	glDisable(GL_BLEND);

	// Common Axis Z - FRONT Side
	// Render the front quad
	glBindTexture(GL_TEXTURE_2D, m_iSkyBoxT[0]);
	glBegin(GL_QUADS);
	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 );
	glEnd();
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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!