Hello *,
my Problem is as following:
I''ve modified NeHe''s tutorial about Outline Fonts a bit, so that it doesn''t only display rotating text, but in addition the text moves forth and back and to the sides as I want it to do. That part works fine. Now to the problem: My idea was it to display a transparent triangle right in front of the moving text, so that it covers the parts of the text just behind it. I tried to give this triangle a color (cyan) as usual in the other tuts using glColor3f, but instead the desired color i get an ugly dark green triangle that isn''t transparent at all. (Additionally it doesn''t cover the text although it is positioned in front of it)...
If I remove the glPrint-Line, the code works and the triangle is cyan-coloured. With Nehe''s glPrint right before it, it doesn''t.
How do I get my triangle coloured now?
Here is the code (Init and drawing section that are modified bye me, the rest is NeHe''s Tutorial #14):
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glEnable(GL_LIGHT0); // Enable Default Light (Quick And Dirty)
glEnable(GL_LIGHTING); // Enable Lighting // Enable Coloring Of Material
glColor4f(1.0f,1.0f,1.0f,0.5f); // Full Brightness, 50% Alpha ( NEW )
glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Blending Function For Translucency Based On Source Alpha Value ( NEW )
glEnable(GL_BLEND); // Turn Blending On
glDisable(GL_DEPTH_TEST); // Turn Depth Testing Off
// Materialfarbe Ambient und Verstreut
glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
BuildFont(); // Build The Font
return TRUE; // Initialization Went OK
}
int DrawGLScene(GLvoid) // Here''s Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(sin(rot/20.0f)*2, cos(rot/10.0f)*2,-8.0f + sin(rot/15.0f)* - 2.0f); // Move One Unit Into The Screen
glRotatef(rot,1.0f,0.0f,0.0f); // Rotate On The X Axis
//glRotatef(rot*1.5f,0.0f,1.0f,0.0f); // Rotate On The Y Axis
glRotatef(rot*1.4f,0.0f,0.0f,1.0f); // Rotate On The Z Axis
// Pulsing Colors Based On The Rotation
glColor4f(1.0f ,1.0f*float(cos(rot/10.0f)),1.0f*float(sin(rot/11.0f)), 1.0f);
glPrint("Irgendein Text %3.2f",rot/50); // Print GL Text To The Screen
rot+=0.7f;
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -5.0f);
glBegin(GL_TRIANGLES);
glColor4f(0.0f, 1.0f, 1.0f, 0.9f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(-1.0f, 0.0f, 0.0f);
glVertex3f(1.0f, 0.0f, 0.0f);
glEnd();
return TRUE; // Everything Went OK
}
Im new to this forum, if someone tell''s me how to post an image, i''ll show you a screenshot to visualize the problem.
Plz, help me before i vaporize my code

Have a nice day...
...
but before that, answer me please!! :D
Have a nice day...... but before that, answer me please!! :D