View Full Version : glutsolidsphere transparency
02-27-2009, 10:41 AM
Is it possible to make a glutSolidSphere transparent? I've fooled around with GL_BLEND, etc., but have not had much luck.
02-27-2009, 03:02 PM
Everything can be transparent. Use something like this before drawing your sphere:
// enable blending.
// set color and alpha
// draw your sphere
// disable blending
02-28-2009, 05:22 AM
Yes, I've tried exactly that, and it doesn't seem to work. My drawing code is as follows:
glColor4f(red, blue, green, 0.5f);
02-28-2009, 07:53 AM
hmm, it is hard to say, screenshots and relevant code might be helpful.
03-02-2009, 08:21 AM
Ok, here is the code in my drawing function:
glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
glutSolidSphere(0.10, 50, 50);
And, here is my initialization code
// set viewing projection
// compute aspect ratio
aspect = (float)h / (float)w;
glOrtho(-VIEW, VIEW, -VIEW*aspect, VIEW*aspect, -5.0, 5.0);
aspect = (float)w / (float)h;
glOrtho(-VIEW*aspect, VIEW*aspect, -VIEW, VIEW, -5.0, 5.0);
glClearColor(1.0, 1.0, 1.0, 0.0);
Hopefully this helps. I'm at a loss here.
03-02-2009, 10:33 AM
Ok, so I've determined that my problem is likely due to the fact that I have lighting enabled as well. I'll read up on how to have lighting and transparency at the same time... is it possible?
03-02-2009, 10:38 AM
Ok, I think the problem was that I should have used the following:
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.