Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

gfaraj

How to make an inventory-like menu...

This topic is 5450 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, I am trying to implement an inventory menu. I already have a GUI system going on. I am using a vertex structure like this one: typedef struct cTransVertex { // coords cVector3 Point; // texture coords cVector2 Tex; Float rhw; unsigned long color; } cTransVertex; It works fine to draw stuff in the screen... Well, in my inventory I want to be able to draw the items of the inventory in 3D, and if I select one of them, I want to be able to rotate it. This is where I know nothing of how to do this. Any ideas on how I would draw this 3D object in the screen? Thanks! George Faraj, FX Legends SPS, Honduras

Share this post


Link to post
Share on other sites
Advertisement
Yes, with directX, you could create a vertex & index buffer of your vertices and render that. You could also use the ID3DXMESH interface if you wanted to. There are a lot of options you can pick from.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I know how to render using vertex/index buffers. The problem I have is how to place those objects on the screen making them look like they''re in the surface of the screen.

Anyone?

Share this post


Link to post
Share on other sites
you can try the viewport thing. In opengl. That's how people do multiple camera rendering (split screen).

set the viewport to a portion of the screen, and render the object.


// something like : minx = 50, miny = 50, maxx = 100, maxy = 85

void Render3DItem(float minx, float miny, float max, float maxy)
{
//--------------------------------------------

// set viewport

//--------------------------------------------

glViewport(minx, miny, maxx-minx, maxy-miny);

//--------------------------------------------

// set projection matrix

//--------------------------------------------

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
...

//--------------------------------------------

// set modelview matrix

//--------------------------------------------

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
......

//--------------------------------------------

// Render 3D object

//--------------------------------------------

......

glFlush(); // not sure you need that though.

}


note that you don't really need the projection / modelview thing everytime, it's just as an example.

[edited by - oliii on January 7, 2004 8:35:53 PM]

[edited by - oliii on January 7, 2004 8:36:38 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
The problem I have is how to place those objects on the screen making them look like they''re in the surface of the screen.

you want to use an orthographic projection (this mean there is no perspective). this will allow you to just draw quads on the screen without them looking funny or 3Dish...

Share this post


Link to post
Share on other sites
But he wants 3D.

Set a viewport, and setup a camera. I don''t know how the z-buffer is handled though, but what you can try


glDepthTest(GL_ALWAYS);
glFrontFace(GL_CW);
glColor3f(0, 0, 0);
glutSolidCube(1000.0f);
glFrontFace(GL_CCW);
glDepthTest(GL_LESS_OR_EQUAL);
// draw 3D item

Share this post


Link to post
Share on other sites
yes, you render all your 3D stuff in perspective mode, then you switch to ortho mode to draw the 2D menus.

Share this post


Link to post
Share on other sites
Well hes not talkin about 2d. In opengl i believe that after you load the identity matrix the camera is facing down the Z axis. So in opengl, I render all my scene, load the identity, translate to the xy where i want my menu objects, and render them.

I know dx uses a 3rd matrix so you might have to set the identity in model and view, i dunno.


edit: Search for how to do a fps shooter, rendering the players arms and gun, its the same effect your looking for.

[edited by - honayboyz on January 11, 2004 3:50:53 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!