我正在使用什么 SDL 和 OpenGL 版本和实现

发布于 2024-10-09 12:58:53 字数 1334 浏览 0 评论 0原文

我下载了 SDL 1.2.14 在 Windows 7 上 我安装了 Mobility Radeon X1800 驱动程序。

我正在使用 Microsoft Visual C++ 2010 Express。

我在“VC++ 目录”中添加了 SDL 包含和库目录,

我添加了以下附加依赖项: opengl32.lib; glu32.lib; SDL.lib; SDLmain.lib;

我将 SDL.dll 添加到我的程序文件夹中,

但没有添加任何 opengl 目录!

#include "SDL.h"
#include "SDL_opengl.h"

bool running = true;

int main(int argc, char* args[]) {
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Surface* screen = SDL_SetVideoMode(640,480,32,SDL_OPENGL);

  glViewport(0,0,640,480);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45.0, 640/480, 1.0, 200.0);

  while(running) {
    glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW); // Swich to the drawing perspective
    glLoadIdentity();
    glTranslatef(0.0,0.0,-5.0);

    glBegin(GL_TRIANGLES);
      glVertex3f(-0.5f, 0.5f, 0.0f);
      glVertex3f(-1.0f, 1.5f, 0.0f);
      glVertex3f(-1.5f, 0.5f, 0.0f);
    glEnd();

    SDL_GL_SwapBuffers();
  }

  SDL_Quit();
  return 0;
}

该程序绘制一个简单的三角形。 我在上面包含了 2 个头文件,我的 Opengl 代码就可以正常工作了!

我不知道我的三角形是在 GPU 还是 CPU 上完成的。我使用的 openGL 版本是什么?

我的意思是我听说微软不再更新 opengl 文件,并且他们使用 OpenGL 1.1 的 CPU 实现或其他东西。

我如何知道我正在使用哪个版本的 OpenGL?我可以在运行时检查吗?

我如何知道我使用的是 CPU 还是 GPU 实现?我可以在运行时检查吗?

感谢您查看我的问题。

I downloaded SDL 1.2.14
on Windows 7
and I have Mobility Radeon X1800 driver installed.

I'm using Microsoft Visual C++ 2010 Express.

I added the SDL include and library directories in the "VC++ Directories"

I added the following Additional Dependencies:
opengl32.lib;
glu32.lib;
SDL.lib;
SDLmain.lib;

I added the SDL.dll to my program folder

I didn't add any opengl directories!

#include "SDL.h"
#include "SDL_opengl.h"

bool running = true;

int main(int argc, char* args[]) {
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Surface* screen = SDL_SetVideoMode(640,480,32,SDL_OPENGL);

  glViewport(0,0,640,480);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45.0, 640/480, 1.0, 200.0);

  while(running) {
    glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW); // Swich to the drawing perspective
    glLoadIdentity();
    glTranslatef(0.0,0.0,-5.0);

    glBegin(GL_TRIANGLES);
      glVertex3f(-0.5f, 0.5f, 0.0f);
      glVertex3f(-1.0f, 1.5f, 0.0f);
      glVertex3f(-1.5f, 0.5f, 0.0f);
    glEnd();

    SDL_GL_SwapBuffers();
  }

  SDL_Quit();
  return 0;
}

This program draws a simple triangle.
I include 2 header files above and my Opengl code just works!

I don't know if my triangle is done on a the GPU or CPU. And what openGL version I'm using?

I mean i heard that Microsoft don't update there opengl files any longer and that they use CPU implementation of OpenGL 1.1 or something.

How do I know what version of OpenGL I'm using? And can I check at run time?

How do I know if I'm using a CPU or GPU implementation? And can I check at run time?

Thanks for look at my problem.

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

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

发布评论

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

评论(2

昵称有卵用 2024-10-16 12:58:53

调用 glGetString

这里是 Microsoft 的 glGetString 文档。 它只是重复了 SGI doc 并告诉您该函数位于 gl.hopengl32.lib 中。

call glGetString

Here is Microsoft's documentation for glGetString. It just repeats the SGI doc and tells you the function is found in gl.h and opengl32.lib.

玻璃人 2024-10-16 12:58:53

实际上,当您安装视频卡驱动程序时,它会“替换”计算机中现有的 opengl,因此您将使用该版本。

OpenGL 同时存在多个版本,使用哪一个取决于初始化 OpenGL 所使用的 HDC。例如,在本地登录会话中运行的应用程序可以获得硬件加速的 GL,而在远程桌面会话中运行的应用程序可以获得基于 CPU 的实现 (Ben Voigt)

目前 Visual Studio 附带的标头和库中仅包含 OpenGL 1.1 ,因此要访问更现代的内容,您需要调用 wglGetProcAddress 来获取指向新函数的指针。

您可以在这里找到更多信息:http://www.opengl.org/wiki/Getting_started

Actually when you install your video card driver it "replaces" the opengl existing in your machine, so you will be using that version.

Multiple versions of OpenGL are present at the same time, and which one is used depends on the HDC used to initialize OpenGL. For example, applications running in the local login session can get hardware-accelerated GL while those running in a remote desktop session get the CPU-based implementation ( Ben Voigt )

The currently header and lib that comes with Visual Studio only has OpenGL 1.1 in it, so to access more modern stuff you need to call the wglGetProcAddress to get pointers to the new functions.

Here you can find more information: http://www.opengl.org/wiki/Getting_started

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