PDA

View Full Version : Whats wrong with this!!



Sean
01-27-2001, 10:22 AM
this program complies on my msvc++ complier but when execute it ,,,,,by the way its windows console appl..... I dont get the open gl window i get the console window with a error message saying FATAL ERROR IN (UNAMED): PIXEL FORMAT WITH NECESSARY CAPABILITIES NOT FOUND d. Today I put the glut32.dlls in the win system dir and the glut.h in th include\gl and everthing else. Also i ran the first program in the opengl superbible 2nd ed. just fine..... whats wrong !!
please help!!!

// glrect.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <gl\glut.h>

void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f,0.0f,0.0f);

glRectf(100.0f,150.0f,150.0f,100.0f);

glFlush();

}

void SetupRC(void)
{
glClearColor(0.0f,0.0f,1.0f,1.0f);
}

void ChangeSize(GLsizei w, GLsizei h)
{
if (h==0)
h = 1;

glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);

glLoadIdentity();

if (w<=h)

glOrtho(0.0f,250.0f,0.0f,250.0f*h/w,1.0,-1.0);
else
glOrtho(0.0f,250.0f*w/h,0.0f,250.0f,1.0,-1.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

void main(void)
{
glutInitDisplayMode(GLUT_SINGLE|GL_RGB);
glutCreateWindow("ernie");
glutDisplayFunc(RenderScene);
glutReshapeFunc(ChangeSize);

SetupRC();

glutMainLoop();
}


thank you

Leyder Dylan
01-27-2001, 03:04 PM
Try to include "windows.h" before "stdfax.h"

Else if doesn't work, send me your source code and I'll try to compile on my computer.

Sean
01-29-2001, 03:19 PM
I found the problem... it was this

glutInitDisplayMode(GLUT_SINGLE | GL_RGB)

I put GL instead of GLUT.... That problem cost me 6 hours ain`t programming great!!

That would make a preacher cuss!!

Thanks any way for the reply,