This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
EDIT: SOLVED The issue was with this line:
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GL_DEPTH);
If I remove GL_DEPTH everything works fine. I remember now when I added it during my experiments. While testing I kept copying around the block I posted below so essentially I was spreading my own shit around.
SUMMARY: My onboard Intel 82865g video adapter does not like depth buffers. Requesting one with GL_DEPTH causes glClearColor to be ignored and all primitives to be rendered red.
EDIT2: genpfault notices that I still don't know what I'm doing. I was using GL_DEPTH (0x1801) instead of GLUT_DEPTH (0x10). This appears to have enabled GLUT_INDEX by mistake. Indeed, providing GLUT_INDEX gives me the exact problem again.
My project can move forward again. Seems small but that was very frustrating. Thank you for those who responded.
ORIGINAL MESSAGE:
All of my colored primitives (in this case quads) are coming out red. There are a few posts about it on the internet but the only "solved" one says it's a graphics driver issue. I've uninstalled, reinstalled, and tried to tinker with any setting I could find but nothing brings other colors back. It is an Intel 82865g that plays Minecraft decently.
The funny thing is that it worked fine just a few weeks ago! I was experimenting with lighting and ever since then no matter what I do shapes are the same ugly shade of red in all of my development projects.
One site mentions that I've enabled something. THAT'S GREAT. I'm ok with that if anybody could possibly tell me what it is so I could disable it. If you say "lighting" please tell me if I have to disable GL_LIGHTING or some other thing like LIGHT0 etc. If you say "texturing" please tell me if there is something besides "GL_TEXTURE_2D" I'm supposed to consider.
Thank you in advance for any useful advice. This is the stupidest crap I've ever had to try to solve.
Here is some code:
class OpenGL
{
public:
static const int DEFAULT_X = -1;
static const int DEFAULT_Y = -1;
static const unsigned int DEFAULT_WIDTH = 640;
static const unsigned int DEFAULT_HEIGHT = 480;
OpenGL();
~OpenGL();
void run();
private:
static void _display();
static void _reshape(int width, int height);
}; // class OpenGL
OpenGL::OpenGL()
{
{
int argc = 0; char **argv = NULL;
glutInit(&argc, argv);
}
glutInitWindowPosition(OpenGL::DEFAULT_X, OpenGL::DEFAULT_Y);
glutInitWindowSize(OpenGL::DEFAULT_WIDTH, OpenGL::DEFAULT_HEIGHT);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GL_DEPTH);
glutCreateWindow("");
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glutDisplayFunc(OpenGL::_display);
glutReshapeFunc(OpenGL::_reshape);
}
OpenGL::~OpenGL()
{
}
void OpenGL::run()
{
glutMainLoop();
}
void OpenGL::_display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(1.0f, 1.0f, 0.0f);
glVertex3i(1, 1, 0);
glVertex3i(1, 4, 0);
glVertex3i(4, 4, 0);
glVertex3i(4, 1, 0);
glEnd();
glutSwapBuffers();
}
void OpenGL::_reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float ortho_width = 12.0f;
float ortho_height = ortho_width * static_cast<float>(height) / static_cast<float>(width);
glOrtho(-ortho_width, ortho_width, ortho_height, -ortho_height, -12.0, 12.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
Does anybody have any ideas? The same issue occurs in VC2008 and VC2003 with different projects. I made a new one tonight and still the same. Hours are being wasted on this.
Post Details
- Posted
- 12 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/opengl/comm...