Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

248 Neutral

About -justin-

  • Rank
  1. Quote:Original post by Namethatnobodyelsetook The problem is likely that you're transposing, as it's not needed (or wanted). OpenGL is right handed, while D3D is left handed. D3D is row major, while OpenGL is column major. The two cancel out such that matrices are stored identically between the two APIs. Thanks for the advice. I had thought I had tried that. Musta been at a different time. Interesting... always thought I had to take the transpose for D3D to get OGL and vice-versa. Thanx alot! Anyway, it works! Well sorta. Still trying to work out the coordinate system bugs. When I try to turn right, I turn left... when I try to walk forward I walk backward. [Edited by - -justin- on October 25, 2008 9:04:37 PM]
  2. Quote:Original post by sirob Quote:Original post by -justin- However, it isn't working.Define "not working". Sorry, was quickly writing this so I didn't explain very well. All I see is my background color, no triangle is being drawn to the screen. Or rather, I don't see a triangle where I'm expecting to see one. And as I said, the matrix I'm producing is identical to the one D3DX produces when given the same information. So that's why I feel it's the setTransform function that isn't performing the way I want...
  3. Hey everyone! Haven't been here in quite a while! I'm using a custom matrix class that I fill out in my camera class. I want to pass that to DirectX to use. However, it isn't working. It's possible I'm looking in the wrong direction or something like that, but I need to at least affirm that it isn't me passing my matrix to D3D that's the problem. I've already written my OpenGL code using glLoadMatrix and it works great. And yes, I did transpose the matrix before sending it to DX. All I'm doing right now is drawing a Triangle to the screen... Here's some code: template <class T> class matrix4x4 { public: T m[16]; matrix4x4(); matrix4x4(T m0, T m1, T m2, T m3, T m4, T m5, T m6, T m7, T m8, T m9, T m10, T m11, T m12, T m13, T m14, T m15); matrix4x4(const matrix4x4<T> &other); void identity(); void transpose(); // Other functions } Draw code: matrix4x4<double> top; top = m_stack.top(); top.transpose(); matrix4x4<float> mat = (matrix4x4<float>)top; m_d3dDevice->SetTransform( D3DTS_VIEW, reinterpret_cast<D3DMATRIX*> (&mat.m) ); MyVertex* arrVertices = new MyVertex[3]; arrVertices[0].color = c1; arrVertices[0].vertex = vec3<float>(0.0, height, 0.0); arrVertices[1].color = c2; arrVertices[1].vertex = vec3<float>(-width/2.0, 0.0, 0.0); arrVertices[2].color = c3; arrVertices[2].vertex = vec3<float>(width/2.0, 0.0, 0.0); m_d3dDevice->SetFVF( D3DFVF_XYZ|D3DFVF_DIFFUSE ); m_d3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST, 1, arrVertices, sizeof( MyVertex )); I did a check with the following code (which does output the triangle) and set the eyelocation to the same location of my camera. The up vector is the same etc. // Create and set the view matrix D3DXVECTOR3 eyeLocation( 0, 0, 20.0f ); D3DXVECTOR3 lookAt( 0, 0, 0 ); D3DXVECTOR3 up( 0.0f, 1.0f, 0.0f ); // World's up vector D3DXMatrixLookAtLH( &matrix, &eyeLocation, &lookAt, &up ); And the matrices are pretty much the same... [Edited by - -justin- on October 25, 2008 9:17:05 PM]
  4. -justin-

    ODE Project Questions

    @shotgunnutter: thanks for the advice, although the issue was not that I didn't have a working application but more why I needed to include the structure definitions. I think it might be a linking issue. Anyway, I've got a new problem to solve :P. I have a long recatangular box that I can put into my system that acts as the bounding volume for a cylinder. The box isn't behaving how I want it. It seems to act like all the weight is put at one particular point. What I actually want is the weight to be evenly distributed. The only thing I can think of is that this is because the center of mass is at (0,0,0) but I'm not sure how to change it. This causes the box to look odd when rotating. Any ideas? Here's my code: sides[0] = 0.25; sides[1] = 1.0; sides[2] = 0.25; // Create a new object object* obj = new object(); // Have gravity effect the object obj->setGravity(true); // We are creating a cylinder obj->setType(2); // Set the position of the object equal to the camera obj->setPosition(cam.getX(), cam.getY(), cam.getZ()); // Set the direction for the object to move cVector move; move.setXYZ(cam.getLookVec().getX()*3.0, cam.getLookVec().getY()*3.0, -cam.getLookVec().getZ()*3.0); // Create the actual body of the world obj->setBody( dBodyCreate(ph.getWorld()) ); // Set the object's position dBodySetPosition(obj->getBody(), obj->getPosition().getX(), obj->getPosition().getY(), obj->getPosition().getZ()); // Give it a linear velocity dBodySetLinearVel(obj->getBody(), move.getX(), move.getY(), move.getZ()); // Give it some rotation based on a random angle (y-axis) dRFromAxisAndAngle (R,0,1,0,dRandReal()*10.0-5.0); dBodySetRotation (obj->getBody(),R); // Set the object's mass dMassSetBox(&m, DENSITY, sides[0], sides[1], sides[2]); dBodySetMass(obj->getBody(), &m); // Set what type of boundary we want to use for collision detection // we'll use a box again, since a cylinder seems to have trouble // when checked against a trimesh obj->setGeom(dCreateBox(ph.getSpace(),sides[0],sides[1],sides[2])); dGeomSetBody(obj->getGeom(), obj->getBody()); Here's a video of the problem: VIDEO [Edited by - -justin- on December 10, 2007 7:21:01 PM]
  5. -justin-

    ODE Project Questions

    Hey guys, I posted a few days about how I was going to start a project with ODE. Well, I was basically told to choose a physics engine for a class and I chose ODE. In my last project I did terrain in OpenGL so I figured I'd extend this. Since I figured I'd have lots of questions as I go along in my project so I decided to make this topic to contain all of them. My goal is to use my terrain and get some basic shapes that collide with the terrain. I actually was planning on doing something like an adventure game but due to time constraints I don't know if it'll be possible. I have finals to prepare for :/ ---------------------------------------------------------- Anyway, question number 1 :D I was fiddling around with ODE trying to get a basic framework up and running. I had my class all ready and everything compiled and linked ok but when I went to run my program I get System.TypeLoadException: Could not load type dxWorld from assembly. I looked around online and found the way to fix this was to put struct dxWorld{} which fixed the problem. However, after looking at the ODE examples and several other tutorials I did not see them doing this. I wondered if I had linked something incorrectly was missing a header file or something. I obviously include <ode/ode.h> which seems to include common.h. That file seems to declare dxWorld. In case you're wondering, the problem isn't just with dxWorld it seems to be an issue with all their common data-structs. I had to declare special structs for space, jointgroup, joints, geom, and bodies. I'm quite puzzled with this issue. Has anyone had this problem before? Can anyone shed some light on what I might be doing wrong? If I declare all those structures then my program seems to work correctly. I guess if I can get away with it that'll be ok, but I'd like to understand what the problem is (if there is one). Thanks!
  6. -justin-

    ODE Linux Installation Help

    Quote:Original post by let_bound If it uses the standard GNU autotools, you should be able to provide the configure script a new prefix: $ ./configure --prefix=/home/myhome $ make $ make install # installs in /home/myhome/lib, /home/myhome/include, etc You'll probably have to make adjustments to your makefile, unless ODE uses pkgconfig or some ode-config script. You'll likely also have to add the directory where the ODE shared object are located to the LD_LIBRARY_PATH environment variable, but that's not specific to ODE. Hmm thanks for the help. I'll try to do that. Not entirely sure about the LD_LIBRARY_PATH but I'm sure I can figure it out. Since I'm a linux novice I tend to stay away and stick with Windows.
  7. Hey everyone, I was told to use a physics engine for a school project and so I decided to pick ODE. I managed to get ODE working on my windows machine at home in a matter of seconds but my projects are supposed to also work on the linux machines at school. I successfully used the ./config and also did make successfully. However, when I went to do make install I was told that I don't have sufficient permissions to install. So my question is, is it possible to somehow change the install directory... or somehow get around this? Any advice would be great so I can get started on my final project... due very soon :/ This isn't really a physics/math question but it deals with a physics API so I wasn't sure where to put it.
  8. oh my goodness... you have no idea how long i spent on that going over and over it :-o IT WORKS!!!! Thank you so much :)
  9. I started on my first (real) openGL shader (glsl) and am trying to do some multitextured terrain. I've looked at many examples and some tutorials but for some reason I can't seem to get the multi part of the texturing :D Any help would be greatly appreciated. Vertex shader: void main() { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = ftransform(); } Fragment shader: uniform sampler2D groundCover; uniform sampler2D grass; uniform sampler2D road; void main() { vec4 ground_color = texture2D(groundCover, gl_TexCoord[0].st); vec4 grass_color = texture2D(grass, gl_TexCoord[0].st); vec4 road_color = texture2D(road, gl_TexCoord[0].st); grass_color *= ground_color.r; vec4 final = mix(grass_color, road_color, ground_color.g); gl_FragColor = grass_color; } } Code right before Triangle-strip glEnable(GL_TEXTURE_2D); glEnable(GL_LIGHTING); sh->enableShader(0); GLint gcover = glGetUniformLocation(sh->getShaderNum(), "groundCover"); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textureHandler::Instance()->getTexture("groundCover")); glUniform1f(gcover, 0); GLint grass = glGetUniformLocation(sh->getShaderNum(), "grass"); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textureHandler::Instance()->getTexture("grass")); glUniform1f(grass, 1); GLint road = glGetUniformLocation(sh->getShaderNum(), "road"); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textureHandler::Instance()->getTexture("road")); glUniform1f(road, 2); Basically I have one texture called groundCover that consists of a red and green channel. The red is where I want my grass to appear and the green channel is where I want a "road" to appear. Then I also have a grass and road texture. Here's an image of what I get (basically just the red/green image no grass or road) EDIT: It seems it is only getting the textures from the zero-th texture unit. If I switch the grass and the ground-cover texture around the grass always shows up (in all three uniform textures). [Edited by - -justin- on November 15, 2007 2:03:33 AM]
  10. I just started getting into GLSL shaders and need to create one for a class. I have always wanted to make some nice looking water. Which seems perfect since we finished talking about refraction / reflection in a ray-tracer a while ago. It seems that I should start with projective texturing which I guess means projecting the scene from world space onto a texture to be passed into the shaders. However I have no idea how to do that. I looked for tutorials but couldn't find much :/ Anyone have any links on how to do this? Any good tutorials on water with GLSL (I saw the gamedev article)? Thanks!
  11. SR-91A for me.... it looks sweet :D I haven't been on gamedev for a while, but still loving your work. I usually check out Sapo's blog, but I almost always gooo "Dang that's some nice art", haha. Keep up the good work. Whatever happened with the girl, or is that a hush-hush topic? :P
  12. -justin-

    We'll frag 'em to zog!

    Hmm not quite sure what format your video is in... I guess RAW. You could probably use VirtualDubMod it is free (slightly old tho)... go search on google :P. If that doesn't work let me know, I have some other ideas!~ EDIT: You'll need some codec to compress it. Not sure what the program comes with but you could always download the DivX or Xvid codecs.
  13. -justin-

    Character Animation

    I'm getting ready to start my next project which I want to be a fairly simple concept (at start). I just want to have a character move around in a 3d world. I can figure out how to do a 3d world pretty easily, but I've never done character animation in 3d before. What is a good file-format to write a reader for? I'll be using openGL to do my rendering. I was probably going to create a character in blender. Any suggestions / resources would be much appreciated!
  14. Ok, I know this post is old, but... EWWwwwwww that's so gross. I'll admit there have been times where I haven't showered for maybe a day. A very rare occurence is two, but this is usually over a school break when I don't need to meet anyone. I can say the engineering department at my school is not like that at all! Wow... I thought of going to Digipen for grad school but now I'm not sure, yuck!
  15. -justin-

    not good

    while i'd prefer to see the sounds in the game (you are so close to a truly COMPLETE blocky-man), i also know how much trouble sounds can be so if you want to release bm tomorrow then go for it! i haven't been by in a while, but it looks great; as usual i'm jealous :) can't wait to see what you decide to work on next!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!