Sign in to follow this  
ITManiac

texture mapped to polygon flickers

Recommended Posts

ITManiac    100
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this