code displays only transparent window
Hi,
I am just learning OpenGL. The code is right out of the OpenGL superbible.
// Simple.c
// The Simplest OpenGL program with GLUT
// OpenGL SuperBible, 2nd Edition
// Richard S. Wright Jr.
#include
#include
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Flush drawing commands
glFinish();
}
// Setup the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
// Main program entry point
void main(void)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Simple");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
}
When I compile this I get a transparent window. If I use glutSwapBuffers() and GLUT_DOUBLE, I get black background and not blue background ?
Thank you.
first point, you''re windows isn''t transparent, it had been initialised with what you have in your video memory. if you move your windows, you will see...
second point, I don''t know. Are you sure the alpha value is 1.0f ? perhaps it''s 0.0f
you use GLUT_RGB, perhaps it should be GLUT_RGBA or something like that? or try to use glClearColor3f(glFloat R, glFloat G, glFloat B) I think this function exist.
Redge
second point, I don''t know. Are you sure the alpha value is 1.0f ? perhaps it''s 0.0f
you use GLUT_RGB, perhaps it should be GLUT_RGBA or something like that? or try to use glClearColor3f(glFloat R, glFloat G, glFloat B) I think this function exist.
Redge
I think that should be glutInitDisplayMode(GLUT_SINGLE|GL_RGB);
maybe you need to call glFlush(); after glFinish();
and you need a glClearColor(1.0f, 1.0f, 1.0f, 1.0f); i think
maybe you need to call glFlush(); after glFinish();
and you need a glClearColor(1.0f, 1.0f, 1.0f, 1.0f); i think
i dont see a resize function. theres a minimum num of functions that are needed in each glut program + IIRC resize is one of them
http://members.xoom.com/myBollux
http://members.xoom.com/myBollux
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement