Tag Info

Hot answers tagged

31

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 ...


14

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.


11

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 ...


7

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 = ...


6

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 ...


6

There is freeglut now : http://en.wikipedia.org/wiki/Freeglut freeglut


6

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 ...


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

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 ...


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 ...


4

First some little tips: 1) Instead of: if (i > 360) i=0; Try i %= 360; 2) glPushMatrix and glPopMatrix are useless in your code, as you apply them on the identity matrix. 3) User GL_TRIANGLES or GL_QUADS instead of GL_POLYGON 4) Avoid global variables, they cause a lot of problems. Solution: Probably a typo: Change glTranslatef(distance_x, ...


4

A common reason for null pointer dereferences on calls to newer OpenGL functions is that they are provided by an extension wrangler library like GLEW through function pointers that are dynamically loaded at runtime. In order for them to be initialized, you need to run the initialization function of GLEW. The correct place to call glewInit() is after you've ...


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 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 ...


3

I haven't read those articles you linked, but whenever I want to implement constant game speed, I call elapsedTime dependent code in my render function. Just like you in your second solution. And I think it's really sufficient for this purpose.


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 ...


3

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 ...


3

you are looking into the wrong things i'm afraid. OpenGL is a graphics library and has nothing to do with network communications. You best bet would be to look up tutorials on network communication examples for the programming language you are using to write your program in


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

You can do it by inserting another "push, transform, draw, pop" sequence before your pop. Something like this: // your current code glPushMatrix(); glRotatef(...); glTranslatef(...); glRotatef(...); DrawTriangle(); // new code glPushMatrix(); glRotatef(...); glTranslatef(...); glRotatef(...); DrawCircle(); glPopMatrix(); ...


3

glIsEnabled if (glIsEnabled (GL_CULL_FACE)) { // culling is enabled } Alternatively you can track state yourself in your own variable, using something like this: glEnable (GL_CULL_FACE); glState.CullEnabled = TRUE;


2

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)


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

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

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

Try a newer version of freeglut; My v2.6, traps cursor with glutWarpPointer without any possibility of escape by mouse.


2

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.



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