Jump to content
  • Advertisement
Sign in to follow this  
ITManiac

texture mapped to polygon flickers

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

Hi, I hav a question regarding openGL.I mapped a texture to a polygon in opengl (C language). I get the result on the display but the image on screen flickers a lot .Please can someone tell me how to avoid flickering .I really need it for a project on openGL.I am a engg student. I hav enclosed the code here: #pragma comment(lib, "opengl32.lib")//Link to the OpenGL libraries #pragma comment(lib, "glu32.lib") #pragma comment(lib, "glaux.lib") #include <windows.h> #include <gl\gl.h> #include <gl\glu.h> #include <gl\glaux.h> #include<stdlib.h> #include<process.h> #include<conio.h> bool loadbmp(UINT textureArray[], char * strFileName, int ID) { if(!strFileName) return false; _AUX_RGBImageRec * pBitMap = auxDIBImageLoadA((const char*)strFileName); if(pBitMap == NULL) exit(0); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, &textureArray[ID]); glBindTexture(GL_TEXTURE_2D, textureArray[ID]); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 3, pBitMap->sizeX, pBitMap->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, pBitMap->data); if (pBitMap) { if (pBitMap->data) { free(pBitMap->data); } free(pBitMap); } return true; }

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!