Tag Info

Hot answers tagged

15

My name is Kevin, and I'm a programmer/designer at Klei. I wrote a bunch of the animation stuff that we used in the Shank series, Mark of the Ninja, and Don't Starve. Our animators work in Flash. We have a concept of a character 'build' which is a set of body-part symbols with multiple views. Depending upon the fidelity of the given game, there are more or ...


10

Is GLUT 3.7 out of date? Absolutely. You should never use it for anything. However, FreeGLUT is perfectly fine to use. It is 100% backwards compatible with GLUT 3.7. FreeGLUT is a good utility to have when you need to slap together a quick and dirty program.


7

The "delta time" used to be the time elapsed between two frame updates (but it can also be used in other contexts; this is usually the result of a time subtraction). You can get the delta time in glut using the glutGet method and the GLUT_ELAPSED_TIME parameter, plus some operations. The following line returns the number of milliseconds since glutInit was ...


6

Klei typically uses a really nice combination of Skeletal animations and sprite-changes. They rig a skeleton, apply sprites to the bones and then they'll swap sprites as an animation frame calls for it. The exact "how" (workflow/tools/etc) can really only come from them, however, they said so themselves when advertising "Shank", pre-release. And if you ...


5

First off, you shouldn't be using GLUT for anything but testing. As far as I know, GLUT was never meant for application development. I recommend picking up SDL or SFML instead. That said, implementing framerate-independent rendering is relatively simple. // global gLastTick contains the last processed tick (ms) // game loop int tick = ...


5

To the best of my knowledge this is Windows-API specific - this functionality doesn't even exist on all platforms. If you want to dig through my code you can find a working Windows implementation (LockMouseCursor is the entry point into the OS module, ClipCursor is the actual Windows function that does the trapping, but there's some niceties surrounding that ...


5

GLTools and GLUT are not the same thing. GLUT is responsible for dealing with things outside of OpenGL. GLUT creates and manages a window and an OpenGL context; the actual stuff that goes on within that context (aka: OpenGL) is not GLUT's responsibility. Maik already covered the reasons why you don't see GLUT in serious applications. GLTools is another ...


4

Even though the original GLUT is not in active development anymore, its still a good tool for its targeted domain, which is quick OpenGL testing and demos. It was never intended to be a framework for developing complex OpenGL programs. from http://en.wikipedia.org/wiki/OpenGL_Utility_Toolkit The two aims of GLUT are to allow the creation of rather ...


4

You can convert between 3D and 2D coordinates in a variety of ways, some of which have more meaning than others. For example you could just drop the Z coordinate, yielding an (x,y) pair, but that probably doesn't do what you want semantically. But you're specifically asking how to convert between model, world or view space 3D and screen space 2D as used by ...


4

Well, the amount of time that passes between frames is highly dependent on the hardware rendering your scene. If the machine just isn't strong enough, there's no way to enforce a fixed frame-rate. However, GLFW DOES allow for very precise time MEASUREMENT (and glut does not), and therefore you can use it to make sure your frame rate is not too FAST. Too slow ...


3

glGenerateMipmap is an extension, unless you are using OpenGL 3 or above (I think). You probably want to use a library like GLEW to load it. See OpenGL Extensions for more information about extensions in OpenGL. Many things that were extensions in 2.x were promoted to the core API in versions 3 and 4, but unless you upgrade to those versions, you'll have to ...


3

If you want to use a perspective matrix for rendering, but an orthographic projection for retrieving mouse input, why not set up both? // this example uses the free and open source OpenGL Mathematics library // you can get it here: http://glm.g-truc.net/ glm::mat4x4 perspective = glm::perspective(90.f, 640.f / 480.f, 0.1f, 1000.f); ...


3

The argument against glut in big projects is that you don't have access to the application loop, so you can't change it to fit your needs. All it has are some callbacks which are triggered from glut, but you don't have much control about it. However, the purpose of glut is to create demos and test apps easily and cross platform, without the need to deal ...


2

Does the problem occur whenever you change the direction or only when changing from positive values to negative values? If it is always, it is most likely the last acceleration stored from last movement which is still slightly bigger than zero. How do you determine that the movement is over in IsCameraMoving() ? Can you show the entire calculation of ...


2

Yes GLUT is obsolete and not under developement since 1998 with the release of the 3.7 version. From French Wikipedia: La bibliothèque GLUT n'est désormais plus en développement et s'est arrêtée à la version 3.7 en mai 1998. http://fr.wikipedia.org/wiki/OpenGL_utility_toolkit Edit: Sorry for the french reference but i haven't find any date on the ...


2

You have to register the function that handles the callback function to be executed when a button is mouse pressed during your display() loop. This has to be done before running the main loop, when you are initialising everything that GLUT requires. glutMouseFunc (MouseButton); Then you need to define the callback function itself, for example, something ...


2

Just at a quick glance I would check in your code where you are drawing the particle system in comparison to when you actually do the world rotations and translations. Drawing the particle system before you do the any changes could cause it to remain in the same position. Just trying to help in any way. Good Luck!


2

I'm unclear as to when exactly you think "immediately" is in this context, or what you're actually trying to do by "watching the keyboard during rendering." But given that you must have known what function is actually being assigned to the keyboard callback (since you had to pass to the glutKeyboardWhatever function), couldn't you just directly invoke the ...


2

glutInitContextFlags(GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG); Never, ever, ever, EVER use FORWARD_COMPATIBLE for ANYTHING. If you want a core OpenGL context in FreeGLUT, ask for it with the right function: glutInitContextProfile(GLUT_CORE_PROFILE); You never need the FORWARD_COMPATIBLE bit set. I know that a lot of code does it, and if I could, I would ...


2

gluLookAt will rotate and translate the world in a way, that the camera will be located at {0, 0, 0} and looks towards the negative z-axis. This is the camera setup used in OpenGL. The camera actually never moves, the world does. Sound confusing? Hell yeah, let me try to explain :) Lets take this example: eye : {300, 0, 0} lookat : { 0, 0, 0} up ...


2

Unfortunately, desktop hardware is not designed for "real time" applications, where "real time" is defined as "thing X has to happen exactly at N". As computers get faster, we're edging closer to that goal, but at the same time the devices try to do more and more things at the same time. In other words - while your graphics hardware may be capable of ...


1

Every rotation in gl is according to a given vector. Dependending from where you are looking at the triangle, you will have to rotate according to that vector. For instance, if you are looking from z>0, you have to rotate your triangle with inZ = 1 such that the triangle rotates according to the vector (0,0,1). UPDATE: Generally speaking, this code ...


1

The problem is that the framerate is too low given the simplicity of the rendering job. Simplicity? You're doing deferred rendering. That's not simple. You're obviously fillrate-limited (as part of the point of deferred rendering is to be fillrate-limited). And your GeForce GT 120M only has 32 shaders. Which is good for a mobile chip, but pretty poor ...


1

Try disabling the glewExperimental support, as that may be attempting to call something in OpenGL that isn't supported by your particular driver. That actual error is GL_INVALID_ENUM​ which, unfortunately, can be raised from pretty much anywhere. Also, what OpenGL driver are you using and in what environment? Some drivers may allow you to enable a debug ...


1

Since OpenGL 3.1 there are actually different types of contexts (called profiles): There is the compatibility profile, which is completely backward compatible down to OpenGL 1.0 and thus includes all deprecated functionality (like glBegin/glEnd or the fixed function pipeline). Then there is the core profile, which has all deprecated functionality removed ...


1

A function can only access two things (a member function can access 3, but you can't use them as GLUT callbacks): its parameters and any globally-accessible data. The parameters to your display function can't provide you the information. Therefore, the only alternative is to make whatever your display function needs to access globally accessible. It's not ...


1

You should have a look at GLFW: http://www.glfw.org/ It's a very easy to use cross-platform API that is still in development and has good documentation! All it does, is to create an OpenGL context and provide means to get input (+ some extra features like threading)


1

With a quick search through the GLUT spec, GLUT does not seem to have mouse capture capabilities. The best you can do (like you seem to be doing) is to warp the cursor to the center and hope the user isn't fast enough (or isn't using a tablet) =) Or, you could switch to SDL or SFML, as GLUT is only designed for testing, not "real" software.


1

I have to watch the keyboard during rendering. Fullstop here. Go over your code again and rethink how stuff works. Logic and rendering should be strictly seperated. There should no situation what-so-ever arise for you to need to check the input during the rendering calls. Rendering doesn't compute input. It just works with what's being given to it.



Only top voted, non community-wiki answers of a minimum length are eligible