Advertisement

black text background in lesson 24

Started by July 29, 2003 11:35 AM
2 comments, last by norleaf 21 years, 7 months ago
Hi, I''m very new at programming OpenGL, but these tutorials sure are a push in the right direction. I have been playing around with the tutorial lesson 24, and noticed that it has a black area around the letters... I then looked back to lesson 17, and found this line: glBlendFunc(GL_SRC_ALPHA,GL_ONE); in the InitGL function. If I comment this line out, it produce the same effect... black square around each letter, but if I add this line to the init file in lesson 24, nothing happens... so what do I do??? Thank you for any help...
--------------------------------------------------------------What's the problem? I don't got a problem, I got fuckin' problems! plurum!-Tim Roth, Four Rooms
I believe that's Alpha Blending, and in your lesson 24 code it's probably turned off somewhere, somehow.

Remember in the earlier tuts, it was turned on by a keypress, with some code further down in the program, so you'll have to add that code also.

Like this;
	if (keys['T'] && !bp)				// Is B Key Pressed And bp FALSE?	{		bp=TRUE;				// If So, bp Becomes TRUE		blend = !blend;				// Toggle blend TRUE / FALSE			if(blend)				// Is blend TRUE?		{			glEnable(GL_BLEND);		// Turn Blending On			glDisable(GL_DEPTH_TEST);	// Turn Depth Testing Off		}		else					// Otherwise		{			glDisable(GL_BLEND);		// Turn Blending Off			glEnable(GL_DEPTH_TEST);	// Turn Depth Testing On		}	}


of course you'll need to add 'bool bp' to your code to define that variable, but it should work then.

I suppose you could just permanently turn on glEnable(GL_BLEND), but I dunno how to do that yet

[edited by - Squalion on July 29, 2003 12:48:30 PM]
lol
Advertisement
You are my hero!!!

If you were here I´d kiss you on the mouth!


Actually I didn''t need all that, I just needed one line of text to blend, so I typed it like this:

glEnable(GL_BLEND);
glPrint(200,200,0,"Issue Orders!");
glDisable(GL_BLEND);

and I had already placed glBlendFunc(GL_SRC_ALPHA,GL_ONE); in glInit() and that was all that was needed... so simple, yet so hard to figure out...

and it made a beautiful blend... thank you
--------------------------------------------------------------What's the problem? I don't got a problem, I got fuckin' problems! plurum!-Tim Roth, Four Rooms
no problem..I''m still learning, so it''s good to be able to help people
lol

This topic is closed to new replies.

Advertisement