如何查看我是否在opengl C ++中单击了一个对象? [英] How to see if I clicked on a object in opengl C++?
本文介绍了如何查看我是否在opengl C ++中单击了一个对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用OpenGL制作颜色选择工具,并做了一个合理的演示。当我单击一种颜色时,它使用glReadPixels函数来查找颜色。这确实有效,但是当我点击背景时它也会采用背景的颜色。有没有办法看看我是否点击了一个物体,这里是颜色选择器。
我尝试了什么:
到目前为止我没有尝试过,因为我不明白如何处理这样的问题。
I'm trying to make a color picker tool using OpenGL, and have made a reasonable demo. When I click a color it uses the glReadPixels function to find the color. This does work however it also takes the color of the background when I click on the background. Is there a way to see if I clicked on an object, here the color picker.
What I have tried:
I have tried nothing so far, as I dont understand how to approach such a problem.
推荐答案
你试过吗?关于如何在opengl中处理鼠标的一些基本示例?
opengl click handler [ ^ ]
Have you tried some basic examples on how to handle mouse in opengl?
opengl click handler[^]
这篇关于如何查看我是否在opengl C ++中单击了一个对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文