I have 2 reshape functions and 2 display function. Each to show something that is completely independent to the other, but they must show what they are meant to show together (two independent things showing at the same time); each on it's own window.
How can I manage those 2 windows? Can anyone explain or indicate some site that explain it (I couldn't find any)? I need something really simple, if possible.
Thanks and sory for the bad English.
I take it, that you're referring to the use of GLUT. First things first: GLUT is not part of OpenGL! (I stopped counting how many times I had to write this into an answer). GLUT operates on the premise, that you register callbacks for each window; each window also has its own OpenGL context.
For a practical use of this you might want to look at my frustum codesample, which uses multiple GLUT windows to render the "same" scene from different angles: https://github.com/datenwolf/codesamples/blob/master/samples/OpenGL/frustum/frustum.c
Related
I recently (5 weeks ago) started my first school year in an school based apprenticeship to become an IT assistant.
We're learning programming and are starting with very basic processing things, while the ultimate plan is to get into C#.
Now I understand that processing might not be the best language for my little project but I still would like to work this out somehow.
What I want to build is a "Stargate Dial Computer". If you know the TV Show you'll know what I'm talking about.
I wanted to make it visually appealing so I decided to use one of the available tools to create my shapes as I am using a DHD (term from the show) for the dial process - see picture: https://i.imgur.com/r7jBjRG.png
This small shape setup already is over 500 lines of code and that seems unwise in itself. Besides that, the plan is to have every single of these trapezoids be a pushable button - but to achieve that manually I'd have to check their coordinates against the mouse collision to utilize them as buttons.
What I'm asking for now is any input on how to work with these shapes in a logical way to make my Idea even possible.
Something like, checking for the shape's color instead of the shape's coordinates itself like 40 times and getting the "active" shape's size in some kind of function. Or a way to just get every shape one by one in a loop, checking for every beginShape and endShape instance if that wouldn't be a performance nightmare.
Keep in mind that I am a beginner. I do know the basics, also of other languages, and I can apply some programming logic here and there - but since I'm not sure what processing can and can't do (yet) I'm looking for an answer to the question if this is even reasonable or possible, or not.
Any help and ideas would be much appreciated!
Thanks!
So, I'm working on a small indie game, and for that I made my own animation system, it's pretty efficent at the moment, but I have some doubts about how it'll operate, after I add 20-30-100 more animations, because (as the title says) every single frame is a different image, in a separated folder.
So the question is: How will this work, after I add more animations? Will it cause longer loadtimes, or worse performance? I'm not totally sure, because eg. the file size of the same animation on a spritesheet and if separated, are almost the same.
The question you should ask yourself when making this sort of decision is "what is the cost of switching if I chose the simpler solution now, and need the complex solution later"?
In this case, switching involves:
Switching your animation system to use the sprite sheet instead of the individual images. This can be really easy if you make your resource fetching and animation calls clean interfaces, and is not too bad unless you do something really horrible in your code.
Getting a program that combines your individual sprites into spritesheets. A quick google search will find dozens of simple programs that do this, but if you need to write your own for some reason it shouldn't be that bad either.
So, my non-answer answer is you probably should not care and if you still care, just take an hour or two and try both.
So what I wonder is if it's possible to make a client sorter that would make clients overlapping eachother. For instance if I have 5 browsers opened and I want to make them overlap each other, is it possible to make a program like this?
I want to use it for a game where I usually may have up to 10 clients opened and therefore it would be nice to have a program sorting them up quickly.
If this is possible. Can the program be written in Java or what language should it be written in?
Although your question is quite fuzzy (e.g. what is a client???) I assumy you mean that you want to tile your windows in some way. Additionally I assume that you would be happy to use an existing program if there is one. There are. Take a look at
http://en.wikipedia.org/wiki/Tiling_window_manager
which is precisely what I think you are looking for. There are links to existing programs to that page as well (some are free).
Okay, I'm going to sound like an idiot with this one. Here goes.
I've been doing iOS development for about a year now, but only tonight have I started doing anything OpenGL related. I've followed Jeff LaMarche's wonderful guide and I'm drawing a neat looking triangle, and I got it to flip around and stuff. I'm one entertained programmer.
Okay, here's the stupid question part: How can I set somewhere for OpenGL to perform glRotatef and glDrawArrays + friends continuously, or at a set frames per second? I've tried Googling it, but really can't come up with good search terms.
Thanks in advance, and get ready to field a ton more of these questions.
While the others make good suggestions for the general case of OpenGL ES, I know that you're probably working on iOS here, Will, so there's a better platform-specific alternative. In your case, I believe you'll be better served by CADisplayLink, which fires off callbacks that are synchronized with the refresh rate of the screen. Using this, you'll get far smoother updates than with a timer or some kind of polling within a loop.
This is particularly effective when combined with Grand Central Dispatch, as I describe in my answer here. When I switched from using a loop to CADisplayLink for updates, my rendering became much smoother on all iOS devices due to fewer dropped frames. Adding GCD on top of that made things even better.
You can refer to my Molecules code for an example of this in action (see the SLSMoleculeGLViewController for how my autorotation is animated with this). Apple's OpenGL ES application template also uses CADisplayLink for updates, last I checked.
You should read up on the concept of game loops.
http://entropyinteractive.com/2011/02/game-engine-design-the-game-loop/
is a good resource to get you started.
Well I'm not an expert on the subject but can't you just put the rotate/draw commands in a while loop that ends when a certain button is pressed or when a specific event occurs ?
I need to render quite alot (tens of thousands) images off-screen using OpenGL.
I am running under Windows and using QT as a framework. the solution can be windows only, it doesn't really matter.
From what I've found using Google there are a number of options for doing this
This article which seems rather dated suggest a few ways, out of which the relevant ones are:
Windows specific - Use CreateDIBSection and somehow bind the texture to it.
Use the pbuffers extension which I seem to be supported on my card.
This thread (Message 6) suggests a QT specific way of doing this using QGLWidget::renderPixmap
My question is - which one would be the fastest way? pbuffers seems to be the safest bet because it is guaranteed to be performed on the hardware but isn't using the CreateDIB method also goes through the hardware? What about the QT method? there seem to be some context-creation issue with this one. surely I would not want to create a new context for every image I create.
Does any one has some good experience with this?
EDIT: Answering the comment -
I have a constant scene which doesn't change at all and I'm rendering it from many different viewpoints. For now the images go back to the user and will be processed by the CPU. Possibly in the future they are going to be processed on the GPU.
Use FBO. It's fast, portable and much nicer to use than pbuffers.
EDIT: For best performance, alternate rendering between two different FBOs:
Render to A
Render to B
Read back from A and process it
Render to A
Read back from B
Goto 2
This way you can be reading back one FBO and then processing it while the GPU renders to the other one in parallel.