code displays only transparent window
Started by flame_warrior, Jun 30 2001 12:33 AM
3 replies to this topic
#1 Members - Reputation: 122
Posted 30 June 2001 - 12:33 AM
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.
Ad:
#2 Members - Reputation: 122
Posted 04 July 2001 - 03:30 AM
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






