• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By tj8146
      I have attached my project in a .zip file if you wish to run it for yourself.
      I am making a simple 2d top-down game and I am trying to run my code to see if my window creation is working and to see if my timer is also working with it. Every time I run it though I get errors. And when I fix those errors, more come, then the same errors keep appearing. I end up just going round in circles.  Is there anyone who could help with this? 
       
      Errors when I build my code:
      1>Renderer.cpp 1>c:\users\documents\opengl\game\game\renderer.h(15): error C2039: 'string': is not a member of 'std' 1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\ucrt\stddef.h(18): note: see declaration of 'std' 1>c:\users\documents\opengl\game\game\renderer.h(15): error C2061: syntax error: identifier 'string' 1>c:\users\documents\opengl\game\game\renderer.cpp(28): error C2511: 'bool Game::Rendering::initialize(int,int,bool,std::string)': overloaded member function not found in 'Game::Rendering' 1>c:\users\documents\opengl\game\game\renderer.h(9): note: see declaration of 'Game::Rendering' 1>c:\users\documents\opengl\game\game\renderer.cpp(35): error C2597: illegal reference to non-static member 'Game::Rendering::window' 1>c:\users\documents\opengl\game\game\renderer.cpp(36): error C2597: illegal reference to non-static member 'Game::Rendering::window' 1>c:\users\documents\opengl\game\game\renderer.cpp(43): error C2597: illegal reference to non-static member 'Game::Rendering::window' 1>Done building project "Game.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========  
       
      Renderer.cpp
      #include <GL/glew.h> #include <GLFW/glfw3.h> #include "Renderer.h" #include "Timer.h" #include <iostream> namespace Game { GLFWwindow* window; /* Initialize the library */ Rendering::Rendering() { mClock = new Clock; } Rendering::~Rendering() { shutdown(); } bool Rendering::initialize(uint width, uint height, bool fullscreen, std::string window_title) { if (!glfwInit()) { return -1; } /* Create a windowed mode window and its OpenGL context */ window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); if (!window) { glfwTerminate(); return -1; } /* Make the window's context current */ glfwMakeContextCurrent(window); glViewport(0, 0, (GLsizei)width, (GLsizei)height); glOrtho(0, (GLsizei)width, (GLsizei)height, 0, 1, -1); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glfwSwapInterval(1); glEnable(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_TEXTURE_2D); glLoadIdentity(); return true; } bool Rendering::render() { /* Loop until the user closes the window */ if (!glfwWindowShouldClose(window)) return false; /* Render here */ mClock->reset(); glfwPollEvents(); if (mClock->step()) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glfwSwapBuffers(window); mClock->update(); } return true; } void Rendering::shutdown() { glfwDestroyWindow(window); glfwTerminate(); } GLFWwindow* Rendering::getCurrentWindow() { return window; } } Renderer.h
      #pragma once namespace Game { class Clock; class Rendering { public: Rendering(); ~Rendering(); bool initialize(uint width, uint height, bool fullscreen, std::string window_title = "Rendering window"); void shutdown(); bool render(); GLFWwindow* getCurrentWindow(); private: GLFWwindow * window; Clock* mClock; }; } Timer.cpp
      #include <GL/glew.h> #include <GLFW/glfw3.h> #include <time.h> #include "Timer.h" namespace Game { Clock::Clock() : mTicksPerSecond(50), mSkipTics(1000 / mTicksPerSecond), mMaxFrameSkip(10), mLoops(0) { mLastTick = tick(); } Clock::~Clock() { } bool Clock::step() { if (tick() > mLastTick && mLoops < mMaxFrameSkip) return true; return false; } void Clock::reset() { mLoops = 0; } void Clock::update() { mLastTick += mSkipTics; mLoops++; } clock_t Clock::tick() { return clock(); } } TImer.h
      #pragma once #include "Common.h" namespace Game { class Clock { public: Clock(); ~Clock(); void update(); bool step(); void reset(); clock_t tick(); private: uint mTicksPerSecond; ufloat mSkipTics; uint mMaxFrameSkip; uint mLoops; uint mLastTick; }; } Common.h
      #pragma once #include <cstdio> #include <cstdlib> #include <ctime> #include <cstring> #include <cmath> #include <iostream> namespace Game { typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; typedef float ufloat; }  
      Game.zip
    • By lxjk
      Hi guys,
      There are many ways to do light culling in tile-based shading. I've been playing with this idea for a while, and just want to throw it out there.
      Because tile frustums are general small compared to light radius, I tried using cone test to reduce false positives introduced by commonly used sphere-frustum test.
      On top of that, I use distance to camera rather than depth for near/far test (aka. sliced by spheres).
      This method can be naturally extended to clustered light culling as well.
      The following image shows the general ideas

       
      Performance-wise I get around 15% improvement over sphere-frustum test. You can also see how a single light performs as the following: from left to right (1) standard rendering of a point light; then tiles passed the test of (2) sphere-frustum test; (3) cone test; (4) spherical-sliced cone test
       

       
      I put the details in my blog post (https://lxjk.github.io/2018/03/25/Improve-Tile-based-Light-Culling-with-Spherical-sliced-Cone.html), GLSL source code included!
       
      Eric
    • By Fadey Duh
      Good evening everyone!

      I was wondering if there is something equivalent of  GL_NV_blend_equation_advanced for AMD?
      Basically I'm trying to find more compatible version of it.

      Thank you!
    • By Jens Eckervogt
      Hello guys, 
       
      Please tell me! 
      How do I know? Why does wavefront not show for me?
      I already checked I have non errors yet.
      using OpenTK; using System.Collections.Generic; using System.IO; using System.Text; namespace Tutorial_08.net.sourceskyboxer { public class WaveFrontLoader { private static List<Vector3> inPositions; private static List<Vector2> inTexcoords; private static List<Vector3> inNormals; private static List<float> positions; private static List<float> texcoords; private static List<int> indices; public static RawModel LoadObjModel(string filename, Loader loader) { inPositions = new List<Vector3>(); inTexcoords = new List<Vector2>(); inNormals = new List<Vector3>(); positions = new List<float>(); texcoords = new List<float>(); indices = new List<int>(); int nextIdx = 0; using (var reader = new StreamReader(File.Open("Contents/" + filename + ".obj", FileMode.Open), Encoding.UTF8)) { string line = reader.ReadLine(); int i = reader.Read(); while (true) { string[] currentLine = line.Split(); if (currentLine[0] == "v") { Vector3 pos = new Vector3(float.Parse(currentLine[1]), float.Parse(currentLine[2]), float.Parse(currentLine[3])); inPositions.Add(pos); if (currentLine[1] == "t") { Vector2 tex = new Vector2(float.Parse(currentLine[1]), float.Parse(currentLine[2])); inTexcoords.Add(tex); } if (currentLine[1] == "n") { Vector3 nom = new Vector3(float.Parse(currentLine[1]), float.Parse(currentLine[2]), float.Parse(currentLine[3])); inNormals.Add(nom); } } if (currentLine[0] == "f") { Vector3 pos = inPositions[0]; positions.Add(pos.X); positions.Add(pos.Y); positions.Add(pos.Z); Vector2 tc = inTexcoords[0]; texcoords.Add(tc.X); texcoords.Add(tc.Y); indices.Add(nextIdx); ++nextIdx; } reader.Close(); return loader.loadToVAO(positions.ToArray(), texcoords.ToArray(), indices.ToArray()); } } } } } And It have tried other method but it can't show for me.  I am mad now. Because any OpenTK developers won't help me.
      Please help me how do I fix.

      And my download (mega.nz) should it is original but I tried no success...
      - Add blend source and png file here I have tried tried,.....  
       
      PS: Why is our community not active? I wait very longer. Stop to lie me!
      Thanks !
    • By codelyoko373
      I wasn't sure if this would be the right place for a topic like this so sorry if it isn't.
      I'm currently working on a project for Uni using FreeGLUT to make a simple solar system simulation. I've got to the point where I've implemented all the planets and have used a Scene Graph to link them all together. The issue I'm having with now though is basically the planets and moons orbit correctly at their own orbit speeds.
      I'm not really experienced with using matrices for stuff like this so It's likely why I can't figure out how exactly to get it working. This is where I'm applying the transformation matrices, as well as pushing and popping them. This is within the Render function that every planet including the sun and moons will have and run.
      if (tag != "Sun") { glRotatef(orbitAngle, orbitRotation.X, orbitRotation.Y, orbitRotation.Z); } glPushMatrix(); glTranslatef(position.X, position.Y, position.Z); glRotatef(rotationAngle, rotation.X, rotation.Y, rotation.Z); glScalef(scale.X, scale.Y, scale.Z); glDrawElements(GL_TRIANGLES, mesh->indiceCount, GL_UNSIGNED_SHORT, mesh->indices); if (tag != "Sun") { glPopMatrix(); } The "If(tag != "Sun")" parts are my attempts are getting the planets to orbit correctly though it likely isn't the way I'm meant to be doing it. So I was wondering if someone would be able to help me? As I really don't have an idea on what I would do to get it working. Using the if statement is truthfully the closest I've got to it working but there are still weird effects like the planets orbiting faster then they should depending on the number of planets actually be updated/rendered.
  • Advertisement
  • Advertisement
Sign in to follow this  

OpenGL skeletal animation?

This topic is 4494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently purchased dave astle's "more opengl game programming" primarily hoping to get information about skeletal animation. turns out that none of the sample code is available for this chapter yet... so basically I'm back at square one... only now I have a better understanding of the work involved. :) From the book i discovered that .ms3d (Milkshape 3d's format) is a decent format for use with skeletal animation. Is there a better format? Or is this format good enough for most people? Also... I still have no demos or sample code to help explain how I might actually implement a skeletal animation system based on the information extracted from a 3d model + it's animation information. I have several artists working in maya, blender, and milkshape 3d. I am hoping to use the .ms3d format simply because every other modeling package can easily export to it, and then the animation can be done with milkshape. I would then like to import the .ms3d files and attempt to animate them. although the truth is that if the animation work could be done in the other packages and exported to milkshape 3d for conversion to the .ms3d format that would be even better. Basically I'm asking for information on where to get my hands on source code, demos. Any and all help would be most appreciated. The first milestone would be loading the .ms3d format, and I suppose the second would be getting it to animate. Thanks in advance for your help, you've never failed me.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
am I asking the wrong questions?

Share this post


Link to post
Share on other sites
Give people time, 2 and a half hours isn't enough. I implemented my ms3d skeletal anim module, in Java, using 2 references. The real soon now skeletal anim tutorial hosted by the very site we're on now, gamedev. Also, chumbalum soft has released a reference implementation on their site: http://www.swissquake.ch/chumbalum-soft/files/MsViewer.zip. Check these out, mish mash the two together and devise a proper animation system yourself, seeing as ms3d doesnt support animation ranges or naming or anything useful like that.

Share this post


Link to post
Share on other sites
Not many master 'skeletal animation' or 'bones animation' as its also called. I learned it in here. check out my old thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=341121&whichpage=1�

If you have more questions about bones animation you can contact me on msn
jplindberg@hotmail.com

good luck

Share this post


Link to post
Share on other sites
There is also a book called "Focus 3d Models" http://reallylongamazonlink

In here they cover skeletal animation, and using ms3d format. You should check it out. I bought the book used for about $3.


EDIT: clean up link ... way to long and stretched the page.

[Edited by - Nit on December 30, 2005 7:49:39 PM]

Share this post


Link to post
Share on other sites
Thanks you guys are great! I originally started programming this thing in Java, but decided to switch to C++ because I felt that I wasn't get the best control of the OpenGL environment. P.S. switching from Java to c++ isn't as hard as I thought it would be. I still miss some of the great Java features though....

Anyway. I'll check out those two references that you mentioned Optus, and I'm almost positive I'll have questions for ASL. I bought 'More OpenGL Game Programming' and Evan Pipho was one of the included authors, I actually had already seen that book that Nit mentioned but was worried that I wouldn't easily be able to apply the DirectX based code to OpenGL.

---

I am hoping you all can answer a few more questions. If this sounds like it won't work please let me know, or if there is an easier or better way please let me know. Thanks...

I load .obj files, convert them to my own format, and load them into my OpenGL program. If I add the additional structures needed to define animation, could I use my format for skeletal animation?

And if I use my format, I will need to write a tool to allow me to animate meshes and save the animation data to my file format, would this be too difficult to do or just stupid on my part? Basically will it be worth all the trouble I went through.

Also Optus, what do you mean by animation ranges? Is it anything like the number of frames in an animation?

---

Thanks again for all the help! Atleast now I have a great place to start. I don't feel completely lost anymore!

Can't wait to hear from you all about my other questions! :)

Share this post


Link to post
Share on other sites
I strongly surgest you dont start out with making your own format for skeletal animation. If you dont know how to handle bones yet, you are reducing your chances of ever learning it. I know how to handle bones now, but it toke me ages and I was mostly on my own. So few people know bones into depth. Most people use OPC because learning it in details mean having to learn advanced matrix and vector math not to mention quarternion math. If you are a person who cant hold your concentration for long dont get involved with bones!!
BUT if you think you have the mental stamina to keep your concentration for some time, I will gladly help you reach the goal.

Here is what I think you should start with:

1.Choose a format supporting bones (not your own to begin with!!!!!!! You ask if we think it would be stupid! My answer is YES).

2.Find the file-specification of your chosen format on the internet.

3.With the specification in hand, build a writer-program that dumps whats inside a given file. Its a good ways to start. It will give you a good over-view of how a file with bones is build up. (you really dont need this step if you have chosen a text-based format like .x for example)

4. Now you have to read all you can find on the net about quaternion, matrix and vector-math conserning skeletal animation. You need to know how to multiply matrices, how to make matrices of quaternions and vectors and how to interpolate quaternions using SLERP. There are various ways to get to your goal but this is how I do it. Also read about bind-pose matrices, global and local matrices. Read my thread again and again - you dont have to understand it all at once. have patence.

when you hit walls on your way (YOU WILL!) feel free to contact me on msn.=D

again good luck

Share this post


Link to post
Share on other sites
Thank you all again!

I was wanting to start with the .ms3d format, but I'm worried about it not being easily usable in games.

I also checked out the collada format, which i don't think is supported yet by any of my artists.

So I was wondering if there is a format anyone could recommend other than .ms3d or collada. I will use .ms3d if I can't find another format, simply because I have several examples on how to implement it already.

Thanks again in advance, you guys have been real helpful.

Share this post


Link to post
Share on other sites
Quote:
I also checked out the collada format, which i don't think is supported yet by any of my artists.

all main modling programs have exporters for collada

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement