Archived

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

DarkKiller

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

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites