I want my program to draw a polygon when mouse clicks on a button I have created on my screen. Where should I put the draw polygon commands? I understand that I can't put in in my mouse function because its effect is lost the next time my display callback runs and it has to be in my display function. But can I set an if condition in my display function?
how can I draw a polygon on mouse click in OpenGL?
2.4k Views Asked by Demian At
1
There are 1 best solutions below
Related Questions in MOUSEEVENT
- Mouse press event called twice
- How to create a boolean local variable as a result of MouseEvent?
- Detect mouse clicks on circles on HTML5 canvas
- How to detect whether touch slide is taking me out of browser window on tablets?
- Mouseenter fired multiple times in Firefox after moving node to another place in DOM
- how to implement mousemove after mousedown using js
- Strange text output of e.getSource() on MouseEvent e
- Event "While Button is Pressed"
- PsychoPy Recording Multiple Mouse Clicks
- how to implement mousemove while mouseDown pressed js
- how to avoid flickering on mouseenter event in jquery?
- How to check if key pressed when clicked event in java
- In WPF how can I control whether another button clicked
- How do I receive the MouseWheel event when mouse pointer is not in the window?
- how to avoid mouse event conflict with timer
Related Questions in MOUSECLICK-EVENT
- How to hide control when click outside it?
- Mouse click event in rshiny
- Node.JS trigger click event to OS
- JavaScript - event.which always return 1 for hovering
- How to find mouseclick first and if not clicked, then go for mouseover
- Making DataGridViewComboBoxCell control drop down on first click when DataGridView does not have focus
- Attaching click to anchor tag in angular
- Foxpro form control "object not found" (but it existed in the form!)
- Opennig a select menu with jquery on right mouse click
- Click-and-stay-highlighted option in Highcharts line chart?
- How to select two pixels from a picturebox in c# and get their proprieties?
- DataGridView not being created
- popup menu on QTreeWidget on right mouse click with python
- d3 trigger mouse click on specific coordinates
- Click off input field event in Angular JS
Related Questions in ONMOUSECLICK
- How to find mouseclick first and if not clicked, then go for mouseover
- Reset timer when mouse is moved anywhere in windows
- How can I add a div on the left part and this will be showed only on the mouse click?
- Javascript / HTML adding an image to center position on the mouse click
- Strange behavior of animation in Easeljs
- how can I draw a polygon on mouse click in OpenGL?
- Applying image swap on mouseclick to existing CSS mouseover
- How can change UI text by mouse-click on an object in Unity3D?
- Clickable enemies
- Use mouse 'on click' instead of 'mouse over' event, jquery
- JavaScript - event relatedTarget is not working for onClick
- starting countdown timer on right mouse click in javascript
- JAVA - Updating A JPanel Every Mouseclick
- onmouseclick function javascript/html
- JavaFX - Event Handlers on different objects created by for loop
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Hope this helps you like it helped me. Once you translate the mouse coordinates into something your 3D object can use (see code below) and store it somewhere, you can draw your object in the loop at the stored coordinates using a transform. I initialized my shape, color, etc. in the init function of my OpenGL program but only draw it when I have selected a number on the keyboard and then clicked somewhere in my viewport. Repeating these steps moves/transforms that object to the new coordinates.
}