Jump to content
  • Advertisement
Sign in to follow this  

2D displays in 3D RPG

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, i was wondering if sumone could help me out, im working on a 3d Role playing game at the moment and im trying to create 2d message boxes and menus on the screen but im not sure how to make sure that the displays always stay visible when the camera moves, any help will be appreciated thanks!

Share this post


Link to post
Share on other sites
Advertisement
You probably just want to render the 3d and 2d portions separately. So in your game loop, render all the 3d stuff. Once that's finished, you'll have your 3d scene in the frame buffer. Grab a handle to that buffer and overlay your 2d menus or textboxes overtop of whatever is there. You can even make it semi-transparent.

Share this post


Link to post
Share on other sites
How about render the 2D Graphic on a very thin rectangle in OPENGL as a texture.
Basically you make an object roughly the size of the 2D image you want to display. Then Texture the 2D image to the object.
It's been a very long time, but that's how I remember it.

Jim Cullen

Share this post


Link to post
Share on other sites
If you are using OGL then you could use these functions


void glEnable2D()
{
int vPort[4];

glGetIntegerv(GL_VIEWPORT, vPort);

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

glOrtho(0, vPort[2], 0, vPort[3], -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}

void glDisable2D()
{
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}


All you have to do is call glEnable2D() before you render the 2D image. Just use a quad for the 2D images and call glVertex2i() instread of glVertex3f(), or something like that anyway.
When you have finished drawing the 2D things just call glDisable2().
Hope this helps ;-)

Share this post


Link to post
Share on other sites
XD sorry i should have said, im using Direct X tho now i wish i was using Open GL!!! thanks anyway, ive tried defining a custom vertex using D3DFVF_XYZRHW - this worked perfect at first as it displays the 2d image on screen and they dont move when the camera does the only problem was that when i applied a texture to this shape all of the lighting around the 3d objects vanished T_T

Share this post


Link to post
Share on other sites
If you go to http:\\www.Download.com\ you can download rqbasic, I think it is 1.1MB you can use directx in it but it may be difficult to use DX and other stuff I'm guessing becouse i dont like to read much on the codes you use that it is imposible. in rqbasic you can use:

shell "...."

to run your other files you have I hope this helps!!!!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!