A
A
Alexey2015-12-13 16:05:00
C++ / C#
Alexey, 2015-12-13 16:05:00

Is it possible to move away from the implementation for win(opengl,height map)?

Here 's how to make a landscape out of a heightmap. This program uses the win ( WndProc,WinMain ) functions. Is it possible to rewrite this code for glut( main(arg c,arg v) )? If yes, then tell me what functions should be replaced/changed. Well, maybe someone has some advice on this topic.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2015-12-13
@alexey_sigida

0) bury GLUT, take GLFW ( www.glfw.org ); if this is unacceptable, unsubscribe in the comments, we will make another instruction;
1) we take an example, we make a window according to the example: www.glfw.org/documentation.html
2) when we are convinced that the window appears and everything works, we start dragging the code from the lesson;
3) calling the rendering code (which is DrawGLScene) is inserted instead of /* Render here */;
4) remove the declarations of Windows descriptors (HDC, HWND and others); windows.h doesn't seem to be needed either;
5) to handle keyboard events, read this: www.glfw.org/docs/latest/input.html#input_keyboard , for the mouse, this: www.glfw.org/docs/latest/input.html#input_mouse. In fact, everything is elementary: callbacks are installed, in which the processing code is already located;
6) in order to adequately exit the main application loop (this is the one that while (!glfwWindowShouldClose(window))) in the right place (for example, by pressing ESC) we call glfwSetWindowShouldClose .
In total, you no longer need WindowProc, you may need initialization code from WinMain and the keyboard processing code will need to be moved to the callback.
Questions in the comments, you can’t tell everything at once.
PS In general, look for modern tutorials, this is OpenGL 2.0, this API is no longer needed by anyone, in the 3rd OpenGL the entire architecture was redrawn (why? For example, because calling glVertex for each vertex is too expensive). Old lessons will be useful for you only for general development in CG.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question