View Full Version : where to read next?
01-12-2009, 09:38 PM
I am trying to create a program that takes user input and draws a line. To make it more complicated, when the user first begins drawing, a cursor like image appears above the most recently drawn segment. When the user stops drawing the cursor should disappear.
I am able to get the line to draw with the cursor. However, the cursor is blurred as if it is another line.
How do I draw the line and also make the cursor "move".
Can I make the cursor image disappear and show what would have been there if the cursor did not exist? (when the user finishes drawing)
Can I make the cursor be in front of the line being drawn?
These are subjects I'm struggling with.
I am looking for the subject matter to start reading.
01-13-2009, 05:49 AM
Have you enabled double duffering? Do you clear the framebuffer between draws?
For simple programs you can start with opengl programming guide for version 1.1(Google for it). It is a little deprecated but it will work for now.
01-13-2009, 09:38 AM
Yes, I do have double buffering. Also, I have the RedBook on OpenGL. I have good books, I'm just trying to figure out the "subjects" i need to re-read :)
My basic drawing programs works fine. the pen looks good, it is blended etc.
If I clear the screen, I am able to get the cursor to move. However, the drawing that the user created is also cleared. If i try to redraw that, it slows down the app quite a bit.
01-13-2009, 09:39 AM
keep in mind...the cursor is not the mouse...it is a pen that helps guide the user. it is part of the opengl program
01-13-2009, 09:52 AM
Please, post some screenshots, I don't understand at all what you are trying to do.
02-08-2009, 03:36 AM
In windows you can set the cursor bitmap through the win32 API, independently from OpenGL and it won't harm framebuffer content. Check the documentation.
Another (OpenGL) solution is to store the parts beneath the cursor with glReadPixels and restore them with glDrawPixels when done.
But if you avoid clearing the buffer you may notice flickering.
Yet another more elegant solution is draw to a framebuffer object or, for more compatibility to system memory and then simply draw the pixels in your window.
Drawing over the line is a matter of drawing the cursor last with depth testing disabled.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.