简体   繁体   English

我可以同时使用多种语言的OpenGL吗?

[英]Can I use OpenGL in more than one language at the same time?

I have an OpenGL program in C#, but I also want to execute OpenGL functions from a C++ DLL. 我在C#中有一个OpenGL程序,但我也想从C ++ DLL执行OpenGL函数。 Will the changes made by my C++ library take effect on the C# program? 我的C ++库所做的更改会在C#程序上生效吗?

Edit: To be more clear, I want to share the same context of OpenGL for two languages. 编辑:更清楚地说,我想为两种语言共享OpenGL的相同上下文。

I am PInvoking functions of C++ that uses OpenGL from my C# code. 我正在从C#代码中调用使用OpenGL的C ++函数。

Current OpenGL context is a thread-local global state. 当前的OpenGL上下文是线程局部的全局状态。

What this means is that as long as the C++ and C# code are executing in the same thread, then OpenGL commands issued in either will be compatible. 这意味着,只要C ++和C#代码在同一线程中执行,则在任一线程中发出的OpenGL命令都是兼容的。

However, if you are dealing with multiple/different threads, you will need to activate the OpenGL context in C++ (assuming it was created in C#), using wglMakeCurrent() . 但是,如果要处理多个/不同的线程,则需要使用wglMakeCurrent()在C ++中激活OpenGL上下文(假设它是在C#中创建的wglMakeCurrent() In order to do this, you'll have to propagate the proper handles somehow. 为此,您必须以某种方式传播适当的句柄。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有一种方法可以将列表中的多个属性同时设置为“”或 null 与 a.ForEach? - Is there a way that I can set more than one property in a list to “” or null at the same time with a .ForEach? 如果有多个具有相同名称的元素,如何使用GetElementsByTagName获取最后一个元素的innerText? - How can I use GetElementsByTagName to get the innerText of the last element if there's more than one element with the same name? 如何通过并行调用使用并行编程来一次调用多个函数? - How can I use parallel programming to call more than one function at a time by using Parallel Invoke? 我可以从同一列中选择多个值吗 - Can I SELECT more than one value from the same column 如何在一个应用程序中使用多个 openGL state? - How to use more than one openGL state in an application? 如何使用ScriptManager的多个功能? - How can I use ScriptManager more than one function? 我如何在angular 2 final中使用templateUrl多个 - How can i use templateUrl more than one in angular 2 final 不能多次使用“等待” - Cannot use 'await' more than one time 在同一时间和同一连接上多次调用SQL Server - Calling SQL Server more than one at same time and same connection 一次在同一个表中进行多个插入操作 - More than one insert operation in the same table at a time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM