In game menus

Started by
6 comments, last by Erik Rufelt 14 years, 8 months ago
hi guys i was wondering how you create in game menus? like for instance in wow when you open up the equipement menu to see your gear. How do they do that? do they render a box and a texture with some gui buttons? Im just wondering cause im looking into putting small inventory boxes and menus for random things in my games/ apps

Game Development Tutorials - My new site that tries to teach LWJGL 3.0 and OpenGL to anyone willing to learn a little.

Advertisement
Quote:Original post by emforce
hi guys i was wondering how you create in game menus? like for instance in wow when you open up the equipement menu to see your gear. How do they do that? do they render a box and a texture with some gui buttons? Im just wondering cause im looking into putting small inventory boxes and menus for random things in my games/ apps
It's usually a quad with a texture, or multiple quads depending on how you want to structure things.

You can also use third party libraries that handle all of the drudgery for you. In my game I use CEGUI for example.
ahh right ok :D thanks alot

Game Development Tutorials - My new site that tries to teach LWJGL 3.0 and OpenGL to anyone willing to learn a little.

ok so i got the textured quad running but how would i make it so it was like in orthogonal projection? aka so it was predominant in the screen

Game Development Tutorials - My new site that tries to teach LWJGL 3.0 and OpenGL to anyone willing to learn a little.

Render it with 2D coordinates, possibly relative if you want it to cover the same percentage of the screen at different resolutions.
How you do that depends on which API. Direct3D supports pre-transformed vertices (D3DFVF_XYZRHW for 9 or an empty vertex shader for 10), and OpenGL can do it for example with an identity projection matrix and glVertex2d.
That would be with D3DXMatrixOrthoLH. That'll create an orthographic projection matrix which you can use to display your GUI with (You'll need to set that matrix on the device though, presumably by setting a shader param).
i tried using the D3DXMatrixOrthoLH but to no avail. I set the zn and zf to 1.0f and 1000.0f respectively but if i try to render the square it will just disappear. How do i set the matrix on the device? and how would i set a shader parameter?

Game Development Tutorials - My new site that tries to teach LWJGL 3.0 and OpenGL to anyone willing to learn a little.

ID3D9Device::SetTransform with D3DTS_PROJECTION for D3D9 fixed-function, or using for example ID3D10Effect::GetVariableByName as described in the Set Effect State (Direct3D 10) guide for D3D10 with effects. If you're not using the effect interface you need to create a constant buffer manually.

This is all covered in the D3D10 tutorials and samples, starting at Tutorial 0: Win32 Basics, which should be completed in order. Specifically tutorial 7 seems to be covering constant buffers.

This topic is closed to new replies.

Advertisement