开发者

OpenGL texturing

开发者 https://www.devze.com 2023-01-27 23:21 出处:网络
Sorry for the plea for help, but I am frustrated. I don\'t know why, but 开发者_如何学编程I\'ve never seemed to be able to get texturing to work in OpenGL. I would really appreciate a minimal example

Sorry for the plea for help, but I am frustrated.

I don't know why, but 开发者_如何学编程I've never seemed to be able to get texturing to work in OpenGL. I would really appreciate a minimal example, so long as it only uses /gl.h /glu.h and standard C++ libraries. Any other insight would be appreciated.

Sorry for simply asking for you to write up a whole program for me, but I could really use it, since EVERY internet example I have seen uses glut. I can't compile it for some reason, and it is very annoying.

Thanks.


You NEED some library or interface to create an OpenGL context (and a window to display it).

GLUT is outdated, but still popular; good options nowadays are GLFW or SDL. I recommend GLFW.

(BTW, why did you even need to compile GLUT? Doesn't it have precompiled binaries for Windows?)

Or you can use system-specific functionality; in your case - WinAPI. However, this is a very tedious process; much unlike the portable solutions which create a window in just one or two lines of code and provide easy input handling.

Once you get your GL window up and running, you can learn texturing (or anything else) from any tutorial. The OpenGL calls will be the same, it doesn't matter how the window was created.


Here's a good tutorial:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06

This code does not use glut.


You need a window manager to create a window, for which you are going to create a context, where you can render your image. You can not do that using standard c++.

It is not clear for which OS you are targeting, but there are cross-platform frameworks, like GLUT, SDL, etc. You can also do it using xlib, if you are on linux.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号