My program is a Win32 console application.
But I want to do the belows for COLLISION DETECTION in my program:
glTranslatef(pos.x, pos.y, pos.z);
But it seems can’t work!
Can anyone help me?Thanks a lot!!!
Could you be a little bit more specific about the problem, do you get an error or incoreect result or what ? (I guess you don’t have an active rendering context)
From an OpenGL point of view there is no difference between a console and a window application, the only difference is that the console application opens a console window, but a normal window application can do this also.
BUT, you do need to create a window or a bitmap to hook up the rendering context to, because you cannot execute any opengl functions without selecting a valid rendering context first.
I am doing a online multiplayers game.
The server program is a Win32 console program, it will not have any rendering part, it just use for receiving and sending message to client and COLLISION DETECTION. It will just open a normal console window to printf the message.
For collision detection, it needs to run following:
glRotatef(-90, 1, 0, 0);
But, I find that it can’t detect the collision. But It works fine in my client program (which have rendering part)
So, I asked whether in my server.cpp can’t run the gl function, although it can compile.
OpenGL is for rendering.
What you’re doing there is basic matrix manipulation. Just do it yourself. Why use OpenGL for something that has nothing to do with rendering?
If you’re stubborn and insist on using OpenGL, the answer has already been given: you need a valid GL context, and for that you need a window.