Sign in to follow this  
azurianarcher

Drawing 2D over 3D

Recommended Posts

Iv been struggling with this for a while, and its really frustrating. All i need to do is draw a two dimensional bitmap over a 3D scene ov already rendered. this is not a texture, im actually trying to make a custom mouse head for my application. Maybe im going about this wrong, if anyone has a better suggestion id love to hear it. thanks, Max

Share this post


Link to post
Share on other sites
I figured someone would say this. The only problem with ortho is that i need to draw it over a 3D scene. In theory i could do all my rendering in perspective and then switch to ortho and texture map a quad with the bitmap i want, but in practice its not working out so well

Share this post


Link to post
Share on other sites
Yeah, thats what you would have to do, switch over to the orthographic matrix mode, and just make a textured quad. If your having troubles, maybe post some code and a description of the problem.

Share this post


Link to post
Share on other sites
Alternatively, if you don't have any transparent 2d elements you could draw the 2D part last and just clear the z-buffer before that. Prevents all the overdraw if you want many big and overlapping windows or stuff.

Share this post


Link to post
Share on other sites
Another real dodgy way of doing it that doesnt involve switching projection modes is to find the up and right vectors from your cameras matrix.
This can be done like this
float mat[16];
glGetFloatv(GL_MODELVIEW_MATRIX, mat);

// get the right and up vectors
cVector right(mat[0], mat[4], mat[8]);
cVector up(mat[1], mat[5], mat[9]);

This is openGL, you can do the same with direct 3d, but the location of the vector info in the matrix might be different.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this