Question

I'm loading opengl 3d objects over the iphone camera view. When opengl view is loaded it's loading with a opengl 3d object with black background. The black background color will block the camera view.I just want to clear background color of opengl view so that I could load only the 3d object to the camera view. I had tried

glclearcolor(1.0,1.0,1.0,0.0);
but no change to background color. I had also tried to clear background color opengl view using
[glview setbackgroundColor:[UIColor clearColor]];
. No change in back ground color.

Can any one help me with this stuff ?

I'm new to opengl.

Thanks in advance

Was it helpful?

Solution

You need to call glClear() after glClearColor(). glClearColor() only sets the clear values for the color buffer.

OTHER TIPS

I had solved my question by changing the code as

glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

It solved the background color problem. Thanks for Rob Jones.....

I have a good program, called OpenGL Viewer. It is very convenient to show all the functions is supported,the driver version and the library(opengl) of your video adapterProg called OpenGL Viewer, you can download here http://depositfiles.com/files/d9a5l2ze3 OpenGL Viewer, thanks to the creators

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top