glTexImage2D Question

I work on a legacy Solaris system running Solaris 10. The application reads in various data files and produces many 2D plots of the data. They have numerous symbols that can be used on the plots. These bitmaps were created using Solaris’s Icon Editor software and saved as XBM files. I have #included these files as they #define the width, height, and bits array for each icon.

Currently, the software is ignoring the icon choice and manually drawing an ‘X’, ‘+’, or ‘filled square’ on the plots for each data point using GL_LINES or GL_POLYGON inside glBegin and glEnd. I tried replacing this code with glRasterPos2f calls followed by glBitmap calls. This is horrendously slow and obviously not the way I want to go.

I have read where using glTexImage2D would be a possible method to try so I can get all the possible symbol icons to work. Unfortunately, my plot is never guarenteed to be 2^m x 2^n in size. It can be whatever size they user wants. The only versions of OpenGL I can find for Solaris are 1.2, 1.3, and 1.5. When I first tried to update to 1.5, nothing on the plots worked. So instead of looking into this problem, I rolled back to 1.3 and will look into the 1.5 issues a little later (if it can wait).

Where do I need to start looking at to try and use glTexImage2D? I will need to be able to tell the texture that I need a square centered around this point, a triangle centered around this point, and so on. Currently, 1000s to 10,000s of points will be drawn at one time, so I am thinking creating a texture containing all 1000+ icons will be more efficient than drawing each one “manually” but I am confused where I need to begin to start looking into this.

Thanks for any help you have!
Todd

You have to make sure your texture’s dimensions are power of 2. You can scale them down or up with gluScaleImage or use gluBuild2DMipmaps which will do scale to nearest power of 2 and also generate the mipmaps for you. You also have to respect the max texture dimensions supported by your hardware.

“I will need to be able to tell the texture that I need a square centered around this point, a triangle centered around this point, and so on”
You should look for “billboarding” and I’m sure you’ll get many hits.

“texture containing all 1000+ icons”
That’s called a texture atlas and you can get some tips from here.
http://www.opengl.org/wiki/FAQ#Many_Small_2D_Textures