How to move objects in OpenGL independently [closed] - opengl

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Given I have several cubes drawn on the canvas, how can they be moved independently of each other? How to define distinct onmouseup/onmousedown/onmousemove listeners to each cube?

How to define distinct onmouseup/onmousedown/onmousemove listeners to each cube?
You normally have only one pointer on the screen, except in multitouch environments, or where individual pointers can be requested for each input device.
So having only one set of mouse event handlers is kind of natual. If you want some distinction between the objects, you must get creative and come up with some way to associate event position with the to be changed object. For example clicking on it.
OpenGL is just a drawing API. It doesn't deal with objects, it doesn't know what a mouse is, or what input events are and it doesn't manage a scene, which also means it won't give you free candy in form of per-object-listeners. All of this must be implemented by you (or some 3rd party library).

Related

Calling 2 functions in an alternating manner in display function [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a function that simply constructs a stick figure in 1 position
I have another function that builds a stick figure in another position.
I now want to call these functions alternatively so that the figure will appear to walk.
I'm not sure if I have to push and pop matrices.
For such rudimentary animation, will a boolean flag not do? (OpenGL doesn't even come into it here, it's merely logic)
I.e. in your draw method:
animate = !animate; // flip flag for 2 possible frames (boolean member variable)
if (animate) {
// draw position 1
} else {
// draw position 2
}
However, bear in mind this is just some quick sample code to get the idea across - it would result in every frame having the animation occur, which would likely occur so fast to be nauseating. You will have to apply time logic to it as well to make the simple animation not just appear as a blur.

need flight simulation library [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to fly an aircraft with a joystick control.
What i want is some open source flight simulation library that will do the mathematics/physics and produce a position value, i.e., given an initial lat-lon-alt-yaw-pitch-roll it will produce the same. These will then be passed to 3d image generator which will place the aircraft at that location with the same attitude values.
Note that only core/kernel like library is required 3d rendering need not be handled by the library.
Preferably it should be a text based c++ library.
Any suggestions/improvements are welcomed.
I don't know what you mean with "text based"... but maybe FlightGear is an option for your needs. It is open source and can be customized. It is built upon the OpenSceneGraph rendering mechanism and contains physics etc. and is written in C++. Both are open source projects and you are able to modify the code if needed.
If closed source is not an K.O. criteria (you asked for open source) RTDynamics has some libs that might be interesting.

Graph editor on Qt [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm writing a graph editor now. The programs must be written on Qt, but the problem is that I don't have enough experience with Qt, but I'm little experienced with C++. Last weeks I read one book about Qt, but I've read about 100 pages, so I know only some basics.
Can somebody give me advices about what classes should I use, please?
What I've already done:
I filled menubar with menus File, Algorithms, About etc.
I suppose that graph vertexes etc I should draw on QGraphicsView, so I added it too, also I add QGraphicsScene and bind them together (ui->setScene(scene)).
Sorry for my mistakes, unfortunately I don't have a complete understanding about all these things.
Also I added QGraphicsRectItem with scene->addRect() and set the flag moveable. But I don't know what classes should I have to use.
So, in general I want to understand how to do next things:
I want to add a panel with 2 buttons (vertex, line). After I chose vertex button (or what it will be) and click on the QGraphicsView - vertex should appear at that point. Also I must be able to change vertex name
After I chose line mode (link, which connected 2 vertexes) I should be able to connect 2 vertexes together depending on graph type (oriented or not).
By clicking on link between vertexes I should be able to change the weight of link.
I think it would be enough for one question.
Sorry if the question is very simple or stupid.
Thanks.
Your question is rather broad so it's nearly impossible to answer it entirely. So instead, I'll offer a really good example you might go look at. This example does much of what you want and might be a good starting set of code to both look at as well as reuse.

How can i render a tiled map with C++/SDL [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to render tiles to the screen from a text file. I have the random terrain generator working, and I can move the data from the text file to a 2d vector. What I'm having trouble with is understanding how to give those tiles the coordinates they need to be rendered at. How would I go about assigning each tile its own coordinates relative to the camera?
I suggest checking this lua tutorial on how create a tile engine in great detail. You'll learn much more then what someone will be willing to post here on stack. Tile Engines as you will see from this tutorial, requires more then just a few lines of code. After you learn it here, it shouldn't be to hard for you to translate it to sdl/c++. Just a thought.
Its a good starting place.

How to introduce keyboard functions in Opengl code [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am new to opengl I tried to make an isosurface by reading from a text file .now I want to introdude keyboard functions in my code so that I can rotate an do all that stuffs. please tell me from where i can study that or give me a sample code
Sudhanshu
OpenGL only deals with drawing stuff. It gives you a canvas and some primitive drawing tools. Nothing more. Anything beyond that is the task of the user interface system provided by the OS.
Maybe you're using GLUT and are mislead by its name. GLUT is not part of OpenGL; it's a rudimentary framework aimed at developing simple OpenGL example programs, but that's about it.