Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Texture mapping and reshape function

  1. #1
    Intern Newbie
    Join Date
    Oct 2011
    Posts
    34

    Texture mapping and reshape function

    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:

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

  2. #2
    Intern Newbie
    Join Date
    Oct 2011
    Posts
    34

    Re: Texture mapping and reshape function

    I solved it. I included viewport in the Reshape function. I also used this gluOrtho2D(0,w,0,h) instead of the previous one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •