Advertisement

Need help creating UI elements...

Started by September 07, 2004 04:39 PM
3 comments, last by VI2 20 years, 2 months ago
Hi, I'm trying to create some UI elements in opengl that I could interact with (IE sliders and such). I'm having trouble defining shapes using pixel screen coordinates. I'd like to be able to draw a rectangle using pixels... ie... (0,0,640,480) to cover the whole screen. I looked at the code from the Nehe site: http://nehe.gamedev.net/data/articles/article.asp?article=13 And tried using it to get coordinates for my vertices by getting values at 0,0 0,480 640,0 and 640,480 but the value i get back from that function is in the range of 350-1000 and the value i should be getting is like 1-3 what gives? How do i do HUD elements if this is the case?
all gui elements (IMHO) should be drawn in orthographic 2D projection mode, so that each coordinate represents a pixel, (0,0) would be the top left or bottom left pixel (or whatever... depends how you set it up). However, I'd strongly suggest checking out GlGooey or some other free gui toolkit, they already have stuff written... so why bother reinventing the wheel : )


Advertisement
Maybe its just me, but a lot of libaries out there seem bloated with a lot of baggage that i don't need. I'd prefer to write it myself... at least its more of a learning experience for me
http://acolyte.ozforces.com.au/tutorials.html

Is a good place to start. Very flexible and custom built gui elements. Although not cross platform, could be modified to do it.

EDIT:
I agree though that they need to be drawn in Ortho mode.
Quote: Original post by rjhcomputers
http://acolyte.ozforces.com.au/tutorials.html

Is a good place to start. Very flexible and custom built gui elements. Although not cross platform, could be modified to do it.

EDIT:
I agree though that they need to be drawn in Ortho mode.


I couldn't ask for more!!! That tutorial is a wonderful resource for me... I'll be reading every detial!

Thanks again for the link!

This topic is closed to new replies.

Advertisement