Window and Research


I’m a total newbie and I had two questions.

  1. I created a window for windows using c++ and I created a 3d object using opengl. How do I get my win32 window to display the 3d object created in opengl. Do I call the functions that I call in the main for the opengl program in winmain of the win32 code.

  2. Where can I get to read research articles about various topics on graphics and their implementation, algorithms, optimizations etc.
    Topics like HDR or volumetric lighting etc.


  1. … yes ? … in fact I do not understand your question. Maybe you mean GLUT instead of OpenGL somewhere ?

  2. a good start is the NVidia SDK :
    a good number of samples are not nvidia-specific.
    It seem weaker on the ATI side, but I found this :

I am using glut right now. When I compile and run any of my Opengl code, I get the 3d object running in a window but there is always a dos console running in the background. Any suggestions as to how I can have the console not appear each time I run any of my OpenGl code. It’s not a big thing but I guess it adds to the presentation.

Thanks a lot for the links

It is not glut that provides the “dos console”. It is how you set up your project compile options.

IE. with VC++ :
Read the paragraph starting with “Setting up in Visual C/C++ 6.0”.

Thought glut is fine and easy to use for display, there is another way of doing (if interested). you can use openGL with MFC. Though its pain staking to set need wgl functions.
For reference, go to MSDN and look out for opengl.

But as a beginner, glut is the best.

to remove console, type


in project properties / linker command line.

IIRC, it is because your main function is called “main” and not “WinMain” but I think it is not the only reason.

I did follow the instructions and well now nothing shows up. I just did two things

Set entry point to main and sub system to Windows subsystem

I am using VC++ 2008 express

Here is the code i used.


#ifdef __APPLE__

using namespace std;

void handleKeypress(unsigned char key, int x, int y)
	switch (key)
	case 27:

void initRendering()

void handleResize(int w, int h)
	glViewport(0, 0, w, h);



	gluPerspective(90.0, double(w)/double(h), 1.0, 200.0);


void drawScene ()




	glVertex3f(-0.7f, -1.5f, -5.0f);
	glVertex3f(0.7f, -1.5f, -5.0f);
	glVertex3f(0.4f, -0.5f, -5.0f);
	glVertex3f(-0.4f, -0.5f, -5.0f);



	// Pentagon
	glVertex3f(0.5f, 0.5f, -5.0f);
	glVertex3f(1.5f, 0.5f, -5.0f);
	glVertex3f(0.5f, 1.0f, -5.0f);

	glVertex3f(0.5f, 1.0f, -5.0f);
	glVertex3f(1.5f, 0.5f, -5.0f);
	glVertex3f(1.5f, 1.0f, -5.0f);

	glVertex3f(0.5f, 1.0f, -5.0f);
	glVertex3f(1.5f, 1.0f, -5.0f);
	glVertex3f(1.0f, 1.5f, -5.0f);

	// Triangle 
	glVertex3f(-0.5f, 0.5f, -5.0f);
	glVertex3f(-1.0f, 1.5f, -5.0f);
	glVertex3f(-1.5f, 0.5f, -5.0f);


int main (int argc, char** argv)
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(800, 600);
	glutCreateWindow("Basic Shapes");


	return 0;

Is there anything else that I need to avoid the console from appearing.

So I did everything again and now every time I compile the program, the .exe file crashes with an error, the .exe has stopped working.

I’m using Vista so is this a Vista problem.

Oops, I made a mistake, actually it is:

/SUBSYSTEM:windows /ENTRY:mainCRTStartup

Sweet thanks it works perfectly now. Thanks a lot