anyone have any luck getting
http://www.gamedev.net/reference/articles/article2085.asp
to work on their computer? I used some basic opengl window setting up code from the nehe site and add the new functions and replaced DrawGlScene appropriately, however when I run it I get just a blank window.
I’m using the code from lesson2 of the nehe site and visual studio.net.
and the glinit function looks like
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
Init();
return TRUE; // Initialization Went OK
}
and the draw scene code is:
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
LoopForever(); //Our cloud function
char texture[256][256][3]; //Temporary array to hold texture RGB values
for(int i=0; i<256; i++) //Set cloud color value to temporary array
for(int j=0; j<256; j++)
{
float color = map256[i*256+j];
texture[i][j][0]=color;
texture[i][j][1]=color;
texture[i][j][2]=color;
}
unsigned int ID; //Generate an ID for texture binding
glGenTextures(1, &ID); //Texture binding
glBindTexture(GL_TEXTURE_2D, ID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, texture);
glMatrixMode(GL_TEXTURE); //Let's move the clouds from left to right
static float x;
x+=0.01f;
glTranslatef(x,0,0);
glEnable(GL_TEXTURE_2D); //Render the cloud texture
glBegin(GL_QUADS);
glTexCoord2d(1,1); glVertex3f(0.5f, 0.5f, 0.);
glTexCoord2d(0,1); glVertex3f(-0.5f, 0.5f, 0.);
glTexCoord2d(0,0); glVertex3f(-0.5f, -0.5f, 0.);
glTexCoord2d(1,0); glVertex3f(0.5f, -0.5f, 0.);
glEnd();
SwapBuffers(hDC);
return TRUE; // Keep Going
}
If anyone has any suggestions let me know. I don’t get any complier errors so I know the syntax is good. But not sure why I don’t see anything on screen.