Equilivent of 'cin' in OpenGL,
Members - Reputation: 316
Posted 08 August 2001 - 12:55 PM
Posted 08 August 2001 - 01:09 PM
If you are programming under Windows is better to use DirectGL instead of OpenGL: DirectGL is an implementation from Microsoft and work faster than OpenGL.
Members - Reputation: 142
Posted 08 August 2001 - 01:46 PM
If it''s the latter, the easiest thing to do would be to just make an array of bools (bool key) and, on WM_KEYDOWN, set key[wParam] = true and on WM_KEYUP set key[wParam] = false. Then, each frame, check if keys[Whatever key you want] == true.
If it''s the former, then you''ll have to write your own function, in which case, on WM_KEYDOWN, add wParam to the next character in a string, and end when the user hits Enter (again, check the value of wParam). You''ll also have to output the text somehow. The best way to do that would be using textured Quads.
I assume the Anonymous Poster is referring to DirectInput, which is another way of ketting keyboard, mouse, and joystick/gamepad input. It is faster than using Windows messages (the easy way I mentioned).
If you didn''t understand anything I just said, then I think it would be a good idea if you didn''t program OpenGL for a while, and learned some more about C++ in Console Mode. I suggest you write your own cin and cout functions (using getch() and putch()) for the console so you have a better idea of how strings work, for one thing. I made the same mistake you''re making; I went straight from "Hello World" to OpenGL, got completely confused, and then actually learned the language and got a firmer grasp of the logic behind it. Now I''m finally venturing (more cautiously) into OpenGL, again. I know it''s easier to wow your friends with pretty pictures (OpenGL) than it is with a mathematical expression parser (what I just finished coding in console mode), but you''ll learn a lot more writing the expression parser - or whatever other algorithm you want to write in console mode. The beauty of the console is, it''s a simple environment to experiment with logic in.