Opengl Window with mouse control for win 32 - windows

I am new to OpenGl, almost new to C++.
I am looking for some code that does the following things.
Open an OpenGL window (maybe using glut)
Rotate the view point when the user press the left mouse button
zoom when the user press the right mouse button
translate the point of view the user press the central button
Basically what I need is a very simple graphics platform in which I will plot results coming from my algorithms. I have tried using the glut library and some code coming from the web, but no luck!
This should be a basic project, can you please point me where to find it. It just seems unreal to me that a so simple project turns to be so hard to find, but I have been googling for hours and no results.
I really appreciate your help,
thank you very much

You're asking for a fair amount of code there. Basic, but not insubstantial. Even if we do provide the code to do what you've asked, I'm not sure if you'll be able to use it to do what you want. The Red Book is a "bible" of openGL programming of sorts and will provide you with many of the functions and how to use them. I found the entire thing online here. Look into Chapters 1-3 for your drawing and rotating. Also, Lighthouse 3D has some great tutorials for you to look at for mouse events (Link). Some knowledge of linear algebra really helps, but you can manage without it.

I don't think it directly implements everything you want, but you might want to look at the 3D graph control on Code Project. This is hardly unique though -- you might want to Google for something like "opengl activex" and look at some of the alternatives. I doubt any will directly implement all you've asked for -- they'll probably include most of the basic operations, but it'll be up to you to make the connection between the mouse operations and the actions in the window.

Related

What's the closest widget to implement this after-effects feature in Gtk

wisgetwas wondering what widget in gtk (using gtkmm) could be used to implemented the movable button looking thing in the picture. and also the dotted line.
dotted line
edit: the widget is supposed to be able to move left and right along the time-track to be able to set the play bounds. Here is a video showing how it looks like in after effects. From sescond 37 is how the behaviour for it supposed to be. https://www.youtube.com/watch?v=QxXevteeumg
edit: from what it looks like there isnt a specific widget which could simplify this. However a regular button can be used and then implementing a method for its drage using the various signal handlers associated with a Gtk button
There is no widget that does this (see the widget gallery).
You can, however, add custom widgets using Cairo. In the official Gtkmm book, there is an example for creating a custom clock widget using the Gtk::DrawingArea. The Gtk::DrawingArea offers a lot of signals which you can connect to.
I have created my own widgets in the past using this and it worked just fine. However, it was a lot of work because:
Cairo lacks good documentation. Understanding the philosophy behind this library is a lot of work, often empirical.
It can be hard to acheive acceptable performance using Cairo. One has to be really careful in how the drawing of the widget is performed. There is often a naive way to do it, which is clearer in the code, but devastating in terms of performance (it often involves useless redraws on the CPU).

What do I need to do this?

I am new to coding and wanted to get some hands on practice with a project I have in mind. Here it is:
Let's say you have blank page and on the side of a screen you have several items you can choose to draw on the blank page. For example the background can be mountains, the ocean, a forest etc. On top of that you can place a house, a church or another selectable element. Whatever you like.
It is like a picture editor where you can put together a picture with different pre-given elements. Or like in video games where you can create your own character.
What would I need to build a web application for that kind of thing?
This link should get you started but it won't be the complete answer to your question - http://www.webdesignerdepot.com/2013/08/how-to-use-html5s-drag-and-drop/
Essentially, you can achieve your image dragging and dropping using similar techniques. It will require a bit of Spike work from yourself, and looking into how HTML5 can handle drag and drop. I discovered this resource fairly quickly and I think the solution you want isn't as complicated as you may think, it just requires a bit of know-how regarding drag and drop operations within HTML5 :-)
Also, there may already be some JavaScript based API's that do this sort of thing easier but I'm not too aware - I suppose starting this way could be a great introduction for you and you may wish to expand once you've done some work for it :-)
Hope this helps you and your coding journey!

create a simple (and visible!) UI slider in Unity 5

![enter image description here][1]please I need some help, this should apparently be something very simple and basic to do, but maybe I'm missing something.
I'm quite newbie to Unity3d, I had no much problem with creating a somewhat flashy 2.D scene (I mean 2D with different layers in Z level), scripts, etc. But I'm having trouble to create a "UI Slider" object: when I create it, it just shows nothing on screen. How can I make it visible? I just need to create a very simple, plain slider whose value can be controlled at runtime by means of a script.
thanks.
Well.. since you give nothing to go on, I suggest that you take a look at a tutorial for the UI:
https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/using-the-ui-tools
If you have troubles after this tutorial, come back with an example of your problem to make people more willing to sacrifice their time in helping you.
Hope this is somewhat useful
Take a look at the Unity3D docs here.
http://docs.unity3d.com/Manual/script-Slider.html
It should have what you are looking for.

Documentation for three.js controls?

three.js comes with many useful controls, which cause camera movement in response to keyboard and mouse input.
They are all at https://github.com/mrdoob/three.js/blob/master/examples/js/controls and accessed in the code as e.g.THREE.OrbitControls .
However, I can't find any documentation or comments that says what situation to use what control for or what they are intended to do.
Can anyone point me to this information, or do I have to analyze the code to figure out if, for example, I prefer FlyControls to FirstPersonControls?
The documentation for the controls does exist, but it was deleted from the repository here. Seems like a bizarre thing to do, but there is an explanation of sorts here. I guess the docs were very incomplete anyway and it was easier to delete them than to finish them. :-p
The source code for most of the controls contains pretty decent comments. I know this isnt as good as proper documentation but it really helps to get a handle on how to set up the controls
The Controls are named by their purpose or the idea they implement. OrbitControls allow you to orbit around some kind of object. Same for Trackball-Controls although the trackball-scheme implies that the camera will rotate around without the up-Axis staying as it was like in orbit-controls. Fly and FPS-Controls are self-explanatory.
Just try the examples and you will see what the difference is. No need to analyse code. Just depends on what you want to achieve.

Qt, CEGUI or wxWidgets for a text game GUI?

I tried to sign up, but I was unable; perhaps a problem from my side. Hopefully I'll get an answer as anonymous.
I apologize for the grammar/syntax, but English isn't my native language.
Recently I lost my job, so I have enough spare time to try something fun. I decided to create a simple text RPG game for me and some friends. It will very close to the board games like Talisman, Dungeon Run, and HeroQuest, using dice and a simple attribute/skill system. So no 3d graphics. The only 2d element, if I decide to include it, will be a map
that will allow the hero to move between locations. Currently I'm using Windows XP SP3, for the game I use wxDev-C++, and although cross platform would be cool, I don't really care.
I have some experience in C++ (currently using wxDev-C++), but I'm far from being called an expert or even a great programmer. I was about to start writing parts of the code, but I decided to check if creating a GUI for the game is possible. In some forums, many suggested I use Qt, CEGUI or wxWidgets, but most examples I saw are grey boxes that are
indifferent at best, when I want something that fits better in a fantasy setting. I don't claim I would do better, but I want a GUI that is more fantasy related.
What I want from the GUI:
1. A "cool" Gui with decent graphics. I could even create an image to serve as a mask in Photoshop, but the GUI builder will have to support imported images.
2. A relatively large textbox in the middle (with a scrollbar) that will display die rolls, damage and options.
3. The ability to display dynamically values (like the change in the health after each action without requiring to refresh manually)
4. Display an icon or a small image of the character in the area where I display stats/abilities.
5. Open new windows created with tha same GUI builder to allocate points, buy/sell things and open a map.
About the map in the game: I decided to create a map in photoshop. When the hero decides to move to another location, a new window will open showing the map. I thought of 2 possible ways to move between locations: 1) Create hotspots on the image and select one by clicking on the name of the location.(I dare not think about the complexity of this so we
move to idea #2) and 2) Have the image as a backgroung to a grid with vertical and horizontal coordinates. When the hero selects a new area to visit, he clicks on the area, but what he really does is click on the grid, which returns the two values (x,y) of the location and informs the game about the area the hero wants to visit.
Yeah, yeah, I know it's too much, so what I'm most interested in are the 1-3. I know that even if they are possible, it will propably take forever, but as I said I have spare time, and I like learning new things. I apologize for the size of the post, but I decided to post as many info as possible so you know what I want.
If any of you has used Qt, CEGUI or wxWidgets could you tell which covers most of my criteria? I saw some great stuff build with CEGUI, but I don't know if it is too hard to learn?
Thank in advance.
I know my answer comes pretty late, I only recently started using stackoverflow fairly recently, but maybe this response will help anybody.
CEGUI fully supports skinning widgets using XML. Our CEED editor (WYSIWYG) fully supports layout editing, but the skinning editor (LNF editor) is not finished as of now (11.11.2014), the development version supports exchanging images however and changing sizes and proportions, but more advanced adjustments have to be done in XML.
CEGUI has an imageset editor, fully supported by the CEED editor. Creating imagesets (sets of named subimages, with position and dimension inside a big texture atlas) is supported there. Additionally there is a way to create imagesets from just a bunch of jpg/png/... files using a tool. You would have to ask for specifics in the forum though because it is not integrated into CEED yet.
So basically with CEGUI you are free to make whatever fantasy GUI you want. Skinning simple elements like buttons and progress bars isn't much work in XML anyways. Without the finished editor, some more advanced widgets are more work to skin, but many skins have already been created done this way and some of them are even publically available in the forum and in the CEGUI stock files.
StaticText widgets supports what you want, you can even use images in there or change fonts and colours in the text if you want. Scrollbars are supported too.
I am not sure what you mean by this. You have to specify this.
A simple "Generic/Image" widget is available in CEGUI for this purpose. You can use precreated images or even RTT textures.
You can create and destroy windows in CEGUI without issues.
Regarding the map: I m not sure what you mean, but getting the position of a click in respect to an image (representing the map) is possible in CEGUI.
CEGUI is not particularly hard to learn. There is always the forums and the chat if you got questions. For an Open Source project it is quite well documented so if you read all of the API docu, and look at the supplied samples in the sample browser, you should already get quite far. And for everything additional there is the forum (search), the IRC chat and a community wiki (mind the targeted versions of an article there though)
For a project like yours, CEGUI seems perfectly suited (this is what it was created for in the first place). Qt is not really optimal for games for numerous reasons. wxWidgets I have never used.

Resources