# overlays

Hey guys
I am quite crap at maths and have a little bit of coding experience(in other words i dont really know what im at). Im using the skybox code from the gametutorials.com site (im sure many of you are familiar with it) as a basis for a simple game i am trying to create.however ive run into a wee problem. Im trying to get a 2d overlay to be displayed on the screen no matter where the mouse is pointed(sort of like where the health is displayed in quake 1). the following code seems to work for strafing but will not work when i move the mouse.It seems to rotate around the object instead. Please could someone help me to figure this out… I realise that the texture is horizontal instead of vertical(i know how to fix this,its not exactly genius stuff)

here is my method :

(texture square3 is in init)

void CreateBorder(float x,float y,float z, float width, float height, float length){

// x = x - width /2;
// y = y - height /2;
// z = z - length /2;

glBindTexture(GL_TEXTURE_2D, g_Texture[Square3]);

// Assign the texture coordinates and vertices for the BOTTOM Side
glTexCoord2f(1.0f, 0.0f); glVertex3f(x, y, z);
glTexCoord2f(1.0f, 1.0f); glVertex3f(x, y, z + length);
glTexCoord2f(0.0f, 1.0f); glVertex3f(x + width, y, z + length);
glTexCoord2f(0.0f, 0.0f); glVertex3f(x + width, y, z);
glEnd();

}

and i call this in my render method :

CreateBorder(g_Camera.m_vView.x,g_Camera.m_vView.y,g_Camera.m_vView.z,20,10,10);

/////////////////////

Ive heard something about changing to ortho and then back again but when i tried it i could see the rest of my 3d scene for a milisecond followed by blackness. If anyone knows how to do this could they please help me…thanks

sorry how ignorant of me the skybox code can be found at :
http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg2.htm

Haven’t done skyboxes etc. but are you trying to put a 2d (against the screen) overlay that you can see the rest of the game through, but this overlay seems to move? could you show how you swapped to ortho, blended and rendered the rest, in pseudo!

Yea, that is one of my to do project’s, a demo of overlay with graphics, if you just want to put a score on the screen that is no problem can help there with a little code.

Originally posted by nexusone:
Yea, that is one of my to do project’s, a demo of overlay with graphics, if you just want to put a score on the screen that is no problem can help there with a little code.

Hey nexus ta for the reply …Id say i could figure this one out easily enough myself but was hoping someone might already have similiar code written to save me a bit of time.The project which is quite big has to be finished in 4 weeks time ya see.Ive recently been looking into stuff like rasterisation…is this the right way to go do ya think ? im afraid i dont have my code with me at the mo but i could email it to you in two days time .can you reply to say if thats ok !

Ta

Rob.

Oh what i am trying to do is have an overlay to put buttons and stuff like that on and then use mouse routines (win) to check for clicks mouse overs etc. I was thinking about using glui but frankly i think it looks a bit gaudy from what ive seen, what i mean is not really suitable for a game (no offence to the creators). I saw some nice interface stuff done using delphi on someones site , but im using c++ so its no good to me really. if anyone knows of a good site for this sort of stuff pls let me know !!