PDA

View Full Version : Help: Wireframe toggle button?



03-02-2004, 01:43 PM
I am not an expert on programming, just learning, but I can design maps. Now this is my problem:
I need a button for changing between wireframe and normal mode in an open gl based game, for inspecting bugs in my maps.
Can anyone help me to provide codes for wireframe toggeling, if possible?

nexusone
03-02-2004, 02:00 PM
By button do you mean keypress of dialog box button?

glPolygonMode("GL_FRONT, GL_BACK, GL_FRONT_AND_BACK", " GL_POINT, GL_LINE, and GL_FILL")

in keyboard routine

if (key == "X" ) debug_mode = abs(debug_mode - 1); //X toggles debug on/off


in drawing routine:

if(debug_mode)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); Draw only lines no fill
}glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // normal mode


Originally posted by School kid:
I am not an expert on programming, just learning, but I can design maps. Now this is my problem:
I need a button for changing between wireframe and normal mode in an open gl based game, for inspecting bugs in my maps.
Can anyone help me to provide codes for wireframe toggeling, if possible?

03-02-2004, 02:27 PM
Like I said, I'm no programmer.
But what I'm looking for is both a toggle button, like a or F1, and a hold "to get wireframe button", wireframe while holding F2 or q.

03-02-2004, 03:26 PM
Is it posible to change into wireframe while running the game?,if not please give me all the commands assosiated with wireframe.

targe
03-02-2004, 03:59 PM
The opengl part of this question has already been answered. Use GL_LINE instead of GL_FILL.

For the keypress you need (in pseudocode) :

// Q or F1 toggles between on/off
if key Q or key F1 is pressed
{
debug_mode = !debug_mode // toggle
}

// A or F2 always shows wireframe if held
if key A or key F2 is pressed
{
debug_mode = true
}
else
{
debug_mode = false
}

targe

nexusone
03-02-2004, 08:33 PM
I answered your question, on how to switch between the two modes.
But we are here to help guide you not write your whole program for you.

I think before you even try to do openGL programming, you should at least learn the basics of programming. This way when someone gives you an answer, you will be able to at least have a clue what they are talking about.

nehe.gamedev.net is a good place to start learning the basics.

03-02-2004, 10:18 PM
Thanks alot, I really appriciate this.
I'm also taking two classes in programming with vbasic next semester.