Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Equilivent of 'cin' in OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 dirkduck   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 August 2001 - 12:07 PM

Im just wondering, what is the equilivant of the cin command in OpenGL? In other words, how can you ask the user for input in OpenGL? thanks McDougal...DUCK McDougal

Sponsor:

#2 Zerosignull   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 August 2001 - 12:09 PM

there isnt ..u have to use con and stuff

~prevail by daring to fail~

#3 SirKnight   Members   -  Reputation: 316

Like
Likes
Like

Posted 08 August 2001 - 12:55 PM

Uh......why would there be a cin in opengl in the first place? Opengl is a 3D GRAPHICS API. Nothing more, nothing less. You should probably read more about what opengl is. Here are some starter places: http://nehe.gamedev.net , http://www.opengl.org

-SirKnight

#4 dirkduck   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 August 2001 - 01:07 PM

sorry, I guess I wasnt really clear, what I meant was the equilivent of cin in WinMain (windows API) while using OpenGL. Does that make any sence?

McDougal...DUCK McDougal

#5 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 August 2001 - 01:09 PM

With glGetInput(deviceId, optA, optB). You should find his declaration in gli.h.
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.

#6 TerranFury   Members   -  Reputation: 142

Like
Likes
Like

Posted 08 August 2001 - 01:46 PM

As for getting text input, do you want people to be able to type a string of text, or do you just want to react to certain keypresses - like, if they hit "UP," move the world towards the camera?

If it''s the latter, the easiest thing to do would be to just make an array of bools (bool key[256]) 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.

#7 dirkduck   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 August 2001 - 06:35 PM

Thanks for the replys everyone. Actually, I already have the single key presses and such, and i am comfortable with those. thanks for the info though, maybe ill attempt my own function on it.

McDougal...DUCK McDougal




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS