Results 1 to 2 of 2

Thread: Plotting an image 2

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Posts
    9

    Plotting an image 2

    OK, you've seen my first problem, here's the second one which is about how I plot the contents of my array. Right now I am using the following code to plot my points.



    glBegin(GL_POINTS);
    for (int i = 0; i < (((imageWidth) * (imageHeight) * 3) - 1); i+=3)
    {
    glColor3d((m_image[i]/255.0), (m_image[i + 1]/255.0), (m_image[i + 2]/255.0));
    // Colour of each pixel starting at top left corner

    glVertex2d((((i/3)%(imageWidth))), (((imageHeight) - 1) - ((i/3)/(imageWidth))));
    // Plots each pixel starting at top left corner, taking a new line when pixel-number is divisible by the width of the image

    }


    glEnd();
    glFlush();

    I don't think this is an efficient method for plotting largish images - it seems very slow. I am aware that there are more simple gl functions that will do the same thing, but not sure where to start. Please provide me with some nice code that I can slot in (working in VC++ 6.0 mfc by the way).

  2. #2
    Member Newbie
    Join Date
    Aug 2001
    Location
    Switzerland
    Posts
    47

    Re: Plotting an image 2

    Look for texture mapping. Then you have to use only a quad or 2 tris(4 points) instead of imageWidth*imageHeight points.

Similar Threads

  1. 3d plotting
    By gezpu in forum OpenGL: General
    Replies: 1
    Last Post: 10-04-2010, 12:05 PM
  2. 3D Function Plotting
    By gr00vy in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-21-2005, 10:35 AM
  3. Plotting surfaces
    By raijinken in forum OpenGL: General
    Replies: 1
    Last Post: 05-20-2004, 11:13 AM
  4. Plotting using OpenGL
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-28-2003, 06:21 PM
  5. Plotting an image 1 (second question coming soon)
    By amuirwood in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-24-2001, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean