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.
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:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(pos.x, pos.y,pos.z);
glRotatef(Players.at(1)->angle,0,1,0);
glRotatef(-90, 1, 0, 0);
float mat3[16];
glGetFloatv(GL_MODELVIEW_MATRIX, mat3);
model2->setTransform(mat3);
BOOL collision1=model->collision(model2);
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.