4
votes

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.

3
Then your problem is your inability to compile glut, not the need for someone to hand-code you an example that doesn't use it.Marcelo Cantos
What OS? Creating a window is platform specific.Alex Budovski
Windows, sorry not to clarifyAlexander Rafferty
I cannot use GLUT tutorials because I don't want to rely on GLUT in my programs.Alexander Rafferty
Well, texturing is finally working. Thanks for your input.Alexander Rafferty

3 Answers

4
votes

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.

1
votes

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.