本文介绍了屏幕外渲染到 win32 服务中的纹理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个可以渲染到纹理的 C++ windows 服务.我将代码作为常规控制台应用程序运行,但是当作为服务运行时 wglGetProcAddress() 返回 NULL.

I'm trying to write a C++ windows service that can render to a texture. I've got the code working as a regular console app, but when run as a service wglGetProcAddress() returns NULL.

谁能告诉我这是否可行,如果可行,我需要做什么才能使 OpenGL 在服务进程中工作?

Can anyone tell me if this is possible, and if so, what do I need to do to make OpenGL work inside a service process?

我还没有让它在 Vista 下工作,但它在 XP 下工作.

I still haven't got this to work under Vista, but it does work under XP.

推荐答案

服务在非交互式桌面上运行.这些桌面不连接到计算机的物理显示设备,而是连接到逻辑显示设备.逻辑显示设备是非常基本的通用 VGA 设备,设置为 1024 X 768,没有花里胡哨.

Services run in non-interactive desktops. These desktops do not connect to the physical display device of the computer but rather to logical display devices. The logical display devices are very basic generic VGA devices set to 1024 X 768 with no bells and whistles.

服务可以使用大多数 GDI 功能,但不能使用 DirectX 或 OpenGL 等高级图形功能.因此,您可以创建窗口、创建或检索设备上下文并进行一些相当复杂的绘图和渲染,但除了简单的 GDI(和一些 GDI+)之外,您不能使用任何其他东西.

Services can use most GDI functions but no advanced graphics functions such as DirectX or OpenGL. So you can create windows, create or retrieve device contexts and do some fairly complex drawing and rendering but you can't use anything but straightforward GDI (and some GDI+).

如果您在 wglGetProcAddress 返回 NULL 后检查 GetLastError,您应该知道失败的原因.

If you check GetLastError after wglGetProcAddress returns NULL you should get the reason for the failure.

这篇关于屏幕外渲染到 win32 服务中的纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 09:35