Win 32 的带鼠标控制的 Opengl 窗口

发布于 2024-08-16 19:02:25 字数 372 浏览 9 评论 0原文

我对 OpenGL 很陌生,对 C++ 也几乎是新手。

我正在寻找一些执行以下操作的代码。

  1. 打开一个OpenGL窗口(也许使用glue)
  2. 当用户按下鼠标左键时旋转视点 当
  3. 用户按下鼠标右键时缩放 平移
  4. 用户按下中央按钮时的视点

基本上我需要的是一个非常简单的图形我将在其中绘制来自我的算法的结果的平台。我尝试过使用 glut 库和一些来自网络的代码,但没有运气!

这应该是一个基本项目,你能告诉我在哪里可以找到它吗?对我来说,一个如此简单的项目变得如此难以找到,这似乎不真实,但我已经在谷歌上搜索了几个小时,但没有结果。

我真的很感谢你的帮助,

非常感谢

I am new to OpenGl, almost new to C++.

I am looking for some code that does the following things.

  1. Open an OpenGL window (maybe using glut)
  2. Rotate the view point when the user press the left mouse button
  3. zoom when the user press the right mouse button
  4. translate the point of view the user press the central button

Basically what I need is a very simple graphics platform in which I will plot results coming from my algorithms. I have tried using the glut library and some code coming from the web, but no luck!

This should be a basic project, can you please point me where to find it. It just seems unreal to me that a so simple project turns to be so hard to find, but I have been googling for hours and no results.

I really appreciate your help,

thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柳若烟 2024-08-23 19:02:25

你要求那里有相当数量的代码。基本,但并非无关紧要。即使我们确实提供了执行您所要求的操作的代码,我也不确定您是否能够使用它来执行您想要的操作。红皮书可以说是一本 openGL 编程的“圣经”,将为您提供许多函数以及如何使用它们。我在此处在线找到了整个内容。请参阅第 1-3 章了解绘图和旋转。另外,Lighthouse 3D 有一些很棒的教程供您查看鼠标事件 (链接)。一些线性代数知识确实有帮助,但即使没有它你也可以应付。

You're asking for a fair amount of code there. Basic, but not insubstantial. Even if we do provide the code to do what you've asked, I'm not sure if you'll be able to use it to do what you want. The Red Book is a "bible" of openGL programming of sorts and will provide you with many of the functions and how to use them. I found the entire thing online here. Look into Chapters 1-3 for your drawing and rotating. Also, Lighthouse 3D has some great tutorials for you to look at for mouse events (Link). Some knowledge of linear algebra really helps, but you can manage without it.

无可置疑 2024-08-23 19:02:25

我不认为它直接实现了你想要的一切,但你可能想看看 代码项目上的 3D 图形控件。但这并不是唯一的——您可能需要在 Google 上搜索“opengl activex”之类的内容,并查看一些替代方案。我怀疑任何一个都会直接实现您所要求的所有内容 - 它们可能会包含大多数基本操作,但是由您来建立鼠标操作和窗口中的操作之间的联系。

I don't think it directly implements everything you want, but you might want to look at the 3D graph control on Code Project. This is hardly unique though -- you might want to Google for something like "opengl activex" and look at some of the alternatives. I doubt any will directly implement all you've asked for -- they'll probably include most of the basic operations, but it'll be up to you to make the connection between the mouse operations and the actions in the window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文