How can I do a simple 2D-Interface with textures?

Started by
6 comments, last by DarkKiller 21 years, 6 months ago
I need a 2D-Texture on the screen to add some information like radar or weapon-ammo.... blood, or whatever to the screen. How can I do that?
DarkMcNugget next time... ;)
Advertisement
Keep in mind that this suggestion comes from another OpenGL beginner:

How are you with bitmaps? I haven''t checked NeHe''s tutorials yet, but OpenGL Game Programming does a great job of explaining the structure of bitmap files in Windows. You can basically set them bit by bit.

look up the following topics in MSDN:

BITMAPFILEHEADER
BITMAPINFOHEADER
glDrawPixels
glReadPixels

This plus either fopen, fread, or the CFile class should give you enough info to be able to read a .bmp file, modify some of the pixels, and spit it out to the screen.

Is there a better way to do what he wants than to just draw a programmatically-manipulated bitmap on the screen?
Yes. Textured quads in orto mode.

Look up

glOrtho()

GL_QUADS

or check this forum for countless of other threads asking (and being answered) the same question.

2DNow - Specializing in yesterday''s technology today!

jo.. i would say so. ortho mask would be ok i think. for blood and decals you should use a partical engine. think thats the usual way of doing such things
also look at some blending technique (for transparentcy stuff)
all right thankx a lott!

I''m familar with bmp and can texture my objects with bmp and jpg.
Thats no problem.

the more important this to do is the translation of all the interface-stuff so that it fit to my screen in every case (moving, rotation and field of view!!)

I''m not familar with matrixes but I''m about to learn that.
DarkMcNugget next time... ;)
ok, my fault....

i got it.

I''ll try a little bit with this before asking again :D
DarkMcNugget next time... ;)
The field of view is still a problem for me.

I went through different drawText() functions from nehe and gametutorials.com but I still don't get it...

maybe anyone is able to explain it easy


I need a function that allows me to position my 2d-picture everywhere on the screen (existing) but I must still be able to change the field of view without seeing the 2d moving (not existing). It should not matter whether I use 45 degree or 75... (I hope you understand what I try to explain here )

[edited by - DarkKiller on October 3, 2002 5:53:35 AM]
DarkMcNugget next time... ;)

This topic is closed to new replies.

Advertisement