View Full Version : Texture mapping and reshape function

03-02-2012, 11:13 AM
I have a problem. I have been able to successfully upload an image unto some geometric shapes. Now I want to draw points on the image I uploaded. I found a piece of code that allows you to do points unto a surface. However when I include the code in my program, the screen turns black. I finally figured out that it was the glMatrixMode(GL_PROJECTION) in the reshape function that was causing the screen to turn black. Once I commented it out or commented out the reshape function, I did not have that problem. I'm able to draw points on the black surface when it appears. But it won't show on the image. So I went back and read up on the different matrix modes but can't still figure out what to do differently to make the code draw the points on the image I uploaded. The mouse function works fine because it allows me to click the bottons to draw the points. The reshape function also looks fine to me:

void reshape(int w, int h)
width = w;
height = h;
/* Set the transformations */
glMatrixMode(GL_PROJECTION );
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glViewport(0, 0, w, h);


03-12-2012, 09:15 AM
I solved it. I included viewport in the Reshape function. I also used this gluOrtho2D(0,w,0,h) instead of the previous one.