Adding Fields to your OpenGL GUI

This is a discussion on Adding Fields to your OpenGL GUI within the Game Programming forums, part of the General Programming Boards category; GLUT has support for printing bitmap fonts. It would be pretty easy to output a letter when the user types ...

  1. #16
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    GLUT has support for printing bitmap fonts. It would be pretty easy to output a letter when the user types it.

  2. #17
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Quote Originally Posted by Shamino
    Like, seriously, i can't believe no one can give a simple answer, 'oh, this is what you need....'
    How far along in OpenGL are you again?

    Coding up a textbox in OpenGL isn't that hard - heck I've done it in QBasic before!

    Just create an algorithm that converts the value of a key into the X and Y location of a bitmap font letter and blit that.

  3. #18
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Finally figured it out...
    I know what you're saying frobozz, i was trying to get around writing code for every single key....

    but... its already done in openGL, here is the code I used..

    Code:
    int keys[256];
    
    void type_text( char tekst[], int max )	{
    		int d = strlen( tekst );
    		for( int w = 32; w < 126; w++ )
    			if( keys[ w ] && d < max ) {				
    				tekst[ d++ ] = w;
    				keys[ w ] = false;
    			}
    		if( keys[ 8 ] ) {
    			if( d > 0 )
    				tekst[ --d ] = 0;
    			keys[ 8 ] = false;
    		}
    	}
    i'm sure theres another bit of code that implements it, but thats the source

  4. #19
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    i've only been doing openGL for a couple months, 6-7

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lists: adding fields (not nodes) & more
    By Mariano L Gappa in forum C++ Programming
    Replies: 15
    Last Post: 11-09-2005, 06:26 PM
  2. Adding functionality to controls on a GUI
    By earth_angel in forum Windows Programming
    Replies: 3
    Last Post: 06-19-2005, 09:31 PM
  3. Adding functionality to controls on a GUI
    By earth_angel in forum C++ Programming
    Replies: 3
    Last Post: 06-16-2005, 01:35 PM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. adding a VB gui
    By DMaxJ in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2003, 08:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21