Jump to content
  • Advertisement
Sign in to follow this  
jbhargav1992

OpenGL CreateDC Failed Message

This topic is 1418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi... I am in the process of programming a platformer game using OpenGL for graphics and Box2D for physics. My only previous experience with graphics was using the SFML library to program a game that does not make any use of physics. I have a little knowledge of the Box2D physics engine since I messed around with the tutorials on iForce2D, but I have very little experience with OpenGL. In order to get a little more acquainted with OpenGL, I wrote a simple code that creates a window and draws a simple shape into it.
 
Here's the code:
 
#include<glew.h>
#include<iostream>
#include<GL\freeglut.h>
    
#include<Windows.h>
#include<stdlib.h>
#include<math.h>
    
#pragma once


void Render_All()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(1, 0, 0); glVertex2f(0.5, 0.5);
glColor3f(1, 0, 0); glVertex2f(0.5, -0.5);
glColor3f(1, 0, 0); glVertex2f(-0.5, -0.5);
glColor3f(1, 0, 0); glVertex2f(-0.5, 0.5);
glEnd();
glutSwapBuffers();
glFlush();
}
    
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(300, 300);
glutCreateWindow("Square");
//glutFullScreen();
glutDisplayFunc(Render_All);
    
GLenum Error = glewInit();
    
if(GLEW_OK != Error)
{
fprintf(stderr, "GLEW Error");
return EXIT_FAILURE;
}
    
glutMainLoop();
return 0;
}
 
The code compiles fine. The output comes out as expected. The only problem is, I get this message in the console window:
 
fghInitialize: CreateDC failed, Screen size info may be incorrect. This is quite likely caused by a bad '-display' parameter.
 
Sniffing around the internet, I found out this is called from the freeglut_init.c file. Apart from that, I couldn't find any way of solving it. How do I solve this? Please help. Thanks.
 
P.S. : This was done in Visual Studio 10. I did the same program in another PC (laptop) under the same conditions, and this message did not occur. So, it is likely a hardware problem. Still, it does not explain how to solve it, though. Please help.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!