DLL中的opengl应用程序要在Win32 C ++窗口中加载 [英] opengl application in dll to be loaded on win32 c++ window

查看:85
本文介绍了DLL中的opengl应用程序要在Win32 C ++窗口中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

我创建了一个opengl应用程序(移动彩色三角形)并完美运行(使用glut).

我想将opengl应用程序代码打包到dll中.

另一个新的win32应用程序将加载dll并创建一个新的空白窗口,现在我想将dll中的代码运行到win32应用程序创建的空白窗口中.


___我的问题是:
opengl应用程序已经在其窗口中运行(使用glut).我以某种方式希望它在win32应用程序窗口而不是default(glut)窗口中运行.

Hi friends

i have created an opengl application(moving color triangle) and runs perfectly(using glut).

i wanted to pack the opengl application code into dll.

another NEW win32 application will load the dll and create a new blank window, now i want to run the code from the dll into the blank window created by the win32 application.



___my problem is:
the opengl application already runs in its window(using glut). i somehow want it to run in the win32 application window and not default(glut) window.

推荐答案

Howdy.

我前一段时间做了这样的事情.源代码很冗长,在这里是午夜-我太累了,无法整理出使自己摆脱GLUT所需的步骤列表-更重要的是,使用openGL绘制到自己的窗口中.

您可能希望查看此zip中的文件:使用openGL进行绘制而不使用glut [ ^ ]

以下几点值得注意:

1)HDC是全局的,因为它是在为GL准备窗口时使用的,它也用于DrawGLSLScene中的SwapBuffers的调用
2)phong.frag和phong.vert必须与exe文件位于同一文件夹中
3)EnableOpenGL是告诉openGL在哪里进行绘制的功能
4)这是一个Code :: Blocks项目(还没有在VS上尝试过-如果能编译的话就不知道了)
5)我从没想过要共享它,只需将openGL场景放在一个对话框中即可,该对话框包含用于操纵多维数据集的控件-旋转滑块和复选框以同时切换(a)灯光和(b)着色器



6)始终使用着色器绘制地板-不论复选框处于何种状态

干杯,
S.
Howdy.

I did something like this a while back. The source is longish and it''s midnight here - I''m too tired to compile a list of the steps needed to free yourself from GLUT - or more importantly, draw with openGL into your own window.

You may wish to look over the files in this zip: Drawing with openGL without using glut[^]

The following things are worth noting:

1) the HDC is a global since it is used when setting up the window ready for GL, it''s also used in the call to SwapBuffers within DrawGLSLScene
2) phong.frag and phong.vert need to be in the same folder as the exe file
3) EnableOpenGL is the function that tells openGL where to do it''s drawing
4) It''s a Code::Blocks project (haven''t tried it with VS yet - dunno if it would compile)
5) I never imagined I''d share it, it was done simply to put a openGL scene on a dialog complete with controls to manipulate the cube - sliders for rotation and check-boxes to toggle both (a) lights and (b) shaders



6) The floor is always drawn using a shader - regardless of the state of the check-box

Cheers,
S.


这篇关于DLL中的opengl应用程序要在Win32 C ++窗口中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆