View Full Version : Plotting an image 2

08-24-2001, 01:27 AM
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.

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



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). http://www.opengl.org/discussion_boards/ubb/biggrin.gif

08-24-2001, 04:45 AM
Look for texture mapping. Then you have to use only a quad or 2 tris(4 points) instead of imageWidth*imageHeight points.