View Full Version : Text Picking
01-01-2002, 04:22 AM
I am drawing text using the OpenGL bitmaps(glBitmap) on to the drawing area created using X-Motif. I want to pick that text using the mouse as like any other geometric objects. So, please give me the coding details using OpenGL.
01-02-2002, 10:44 AM
OpenGL has the selection buffer and that can be used for picking. You need to determine the dimensions of the glBitmap to be drawn and render a invisible primitive in the exact location.
Or better yet, just use textured primitives for your text and use those for the selection buffer as well.
01-03-2002, 02:36 AM
But , how to find the dimensions of a bitmap character.So that , I can draw a rectangle around that bitmap , then I can pick.
Please , give me an idea.
01-03-2002, 07:01 PM
The glBitmap will be a raster operation, so you know for certain which pixels are gone get rendered to.
You need to know the current raster position. Its also best for this case to use a ortho projection, and to have ortho be the size of your screen.
glOrtho(0, width, 0, height, -1.0, 1.0);
The primitive can be
I hope this is correct. You can do a test and see. Also, there are the rasterization rules of opengl that may effect the exact pixels that get rendered too (something about a tiny offset needed in glVertex calls - 0.375 I think)
PS: cross your fingers!
01-03-2002, 07:03 PM
That may need to be
01-03-2002, 08:19 PM
thank you very much.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.