void Menu::RenderMenu(float red, float green, float blue)
{
glTranslatef( 0.0f, 0.0f, 0.0f);
glBindTexture(GL_TEXTURE_2D, background[0]);
glBegin(GL_QUADS);
//glColor3f(1.0f,0.0f,0.0);
glTexCoord2f(-2.0f, 2.0f); glVertex3f( 0.0f, 768.0f, 0.0f); // Upper Left
glTexCoord2f(-1.0f, 2.0f); glVertex3f( 1024.0f, 768.0f, 0.0f); // Upper Right
glTexCoord2f(-1.0f, 1.0f); glVertex3f( 1024.0f, 0.0f, 0.0f); // Lower Right
glTexCoord2f(-2.0f, 1.0f); glVertex3f( 0.0f, 0.0f, 0.0f); // Lower Left
glEnd();
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
glColor4f(red, green, blue, 0.3f);
glBegin(GL_QUADS);
glVertex3f( 300.0f, 625.0f, 0.0f); // Upper Left
glVertex3f( 700.0f, 625.0f, 0.0f); // Upper Right
glVertex3f( 700.0f, 50.0f, 0.0f); // Lower Right
glVertex3f( 300.0f, 50.0f, 0.0f); // Lower Left
glEnd();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glColor4f(red, green, blue, 0.5f);
glBegin(GL_QUADS);
glVertex3f( 302.0f, 623.0f, 0.0f); // Upper Left
glVertex3f( 698.0f, 623.0f, 0.0f); // Upper Right
glVertex3f( 698.0f, 52.0f, 0.0f); // Lower Right
glVertex3f( 302.0f, 52.0f, 0.0f); // Lower Left
glEnd();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
Outlining a glQuad(); ?
Hello again, my menu system is working very nicely so far and I have ran into a bunch of bumps in the road! OpenGL rules! I love it so far...but I was wondering if there was a way to outline a quad that I draw...this is the code I have so far...
What I am doing is enabling blending to give the first quad a duller look and then the one on top, a brighter look, but I want to switch the two, so its bright around the border and dull in the center...
is there a way to outline or would it be better to go for a texture?
EDIT 1: It would help if I added the code...lol
<- http://www.digitalexplosions.com ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)
[edited by - Krisc on December 7, 2002 2:09:23 PM]
If I understand you right, you want a line around the outside of the quad. If so, simply draw the vertices again inside glBegin(GL_LINES); and it will draw a line around the edge. You may want to adjust the co-ordinates slightly to move the line in or out.
Sorry if I don''t understand GL_LINES correctly, but I would think that based on GL_QUADS, I would have to specify like a lot of vertices...I am looking to just be able to do it quickly and easily...
I used a texture and it is working better, but I am still looking for an Outline routine...
<- http://www.digitalexplosions.com ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)
I used a texture and it is working better, but I am still looking for an Outline routine...
<- http://www.digitalexplosions.com ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)
You can use glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); to draw as wireframe and glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); to return to solid primitives.
If you first draw a polygon solid and then draw it as wireframe, you can use that to outline your polygon. Just set the appropriate colour and disable texturing.
BTW, GL_LINES isn't that hard to use. Just draw a line from point A to B, B to C, C to D and D back to A and you have your quad. It takes only twice as many vertices to use lines.
[edited by - Kippesoep on December 7, 2002 3:12:01 PM]
If you first draw a polygon solid and then draw it as wireframe, you can use that to outline your polygon. Just set the appropriate colour and disable texturing.
BTW, GL_LINES isn't that hard to use. Just draw a line from point A to B, B to C, C to D and D back to A and you have your quad. It takes only twice as many vertices to use lines.
[edited by - Kippesoep on December 7, 2002 3:12:01 PM]
I just thought of something that has been changing my mind. This is an engine, and so I am going to keep it textured so that the developer/modder can easily just make a texture and use that instead of having to draw lines and quads and having them declare the color. Thank you though, I will attempt to remember these functions for future use!
<- http://www.digitalexplosions.com ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)
<- http://www.digitalexplosions.com ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement