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 answers
Related Questions in MOUSEEVENT
- Detect Mouse Clicks; Terminate Program on Scroll Wheel Movement
- how to create a mouseEvent with target in typescript without dispatching?
- How to make (mulitple) image appear when clicking?
- An HTML Link Element ("a") Refuses to Attach Itself to Event Listener
- "contextmenu" Event interrupts "onmousemove" from executing a function
- right click event for wxDataViewListCtrl
- How to save the brush event when hovering over elements with their own events
- Mouse input not blocked when running Python code on Ubuntu using pynput library
- createJS does not reconize currentTarget
- How To Make Mouse Recoil be smooth?
- What's the benefit of multiline code with multple variables compared to combined actions pygame.mouse.getpos() that combine them
- How can I prevent the behavior of swipe backward of browser on mac?
- Adding a circle which follows a mouse and changes colours based on the current colour | Interactive SVG Colouring Page | Using JavaScript
- How to move the background image by clicking and dragging the mouse smoothly?
- How to add an event listener to elements (or children)
Related Questions in MOUSECLICK-EVENT
- How to change the person my code was following/tracking by clicking or selecting another person by mouse? Rest details of project below
- Trying to count mouse clicks within an iframe embedded in qualtrics
- Powershell ISE -MouseclickEvent
- Get assigning var from mouse clicked
- Why is the background still included when applying the border?
- Treeview highlights a random node after node click event
- Unable to remove pop-up immediately using selenium in python
- Double Clicks in Plotly not registering
- python: how do I do locateCenterOnScreen with pydirectinput instead of pyautogui:
- How do I update Tkinter label that has mouse click in it?
- Unable to place the marker on exact mouse click area on the image
- I'm trying to display a stacked bar plot when someone click in a specific country on a highcharter map
- Click and Double Click Not Working on Ag Grid Cell
- How do I take a user click_event and use that to pull data from another source
- How do i bind "mouse is pressed" in Python's tkinter?
Related Questions in ONMOUSECLICK
- Python: import email subject from outlook by clicking on a certain email
- JavaFX: Why doesn't my MinMax algorithm make a move when it starts a TicTacToe game?
- Tracking button press and release while in the trigger
- RectangleShape Usercontrol Pass Shape_Click Event to Usercontrol_Click in VB.Net
- Return the X and Y values from the on_mouse function
- Tooltip on mouse click. Code snippet works but when embedded on a website, it does not work. Not sure why
- How to get coordinates of upper left corner of a div
- mouseMove only triggers after mouseClick
- How can i make something when mouse click hold down with Python
- How can change UI text by mouse-click on an object in Unity3D?
- Javascript / HTML adding an image to center position on the mouse click
- Why onclick function isn't working in Javascript snippet below?
- onmouseclick function javascript/html
- Python check if Left Mouse Button is being held?
- C# OnClick .NET framework coordinate limitation
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?
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)
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.
}