Page 4 of 4 FirstFirst ... 234
Results 76 to 89 of 89

Thread: OpenGL.

  1. #76
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by eska View Post
    I don't think you will get much help if you don't put it more simple. There might be some awesome math guy around here but he might not understand all that opengl stuff you are referering to.

    This is what most of us probably understand from your posts:
    "Ok so brandon grab some opengl stuff data (lots of point and stuff), and then he want to use some mathematic formula on that data to know where the camera is (or is looking?), and then some more math to know where the player is."

    I'm going to edit this post soon. Basicaly, I'm going to sumarise what I understood (or not) of your last 2-3 posts.

    Oh no no.. LOL I gave up on the Camera stuff for now so don't worry about the math. I'm saying:

    Given a buffer with a pointer to data + the size in bytes, what's a good algorithm to use to generate ID's. That can't possibly be that hard to understand.. well I don't think?
    Besides there REALLY isn't any other way I can explain it or break it down..
    If you want to help on camera stuff then you'd need to know: http://en.wikipedia.org/wiki/Rotation_matrix

    and: https://docs.google.com/viewer?a=v&q=cache:cwEG3qVre3wJeople.hsc.edu/faculty-staff/robbk/Coms331/Lectures/Lectures%25202011/Lecture%25207%2520-%2520The%2520Modelview%2520Matrix.pdf+&hl=en&gl=ca &pid=bl&srcid=ADGEESh6nXiNeKi0kFaIq5BVPDqcP5XHKAf8 eNxBb1vIwbeO5LHk_sK3PeIOJU436jeISY9HAiYVjQmnSr11Yh L3dI_6c_LBRMNGsZaZacm2nNkl6jjf4DzNKz-ynLd_zgG_ipV3YwFf&sig=AHIEtbTyxowPXOGojjff_VGL841L UdjuDQ

    And that's worst than I explained..

    EDIT: Here is how a vertex buffer may look:
    Last edited by Brandon; 08-08-2012 at 10:01 PM.
    I am Ggzz..
    Hackintosher

  2. #77
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    I wished I atleast understood what you are trying to tell us, look great for what I know :P Hope you will keep the nice work up
    Edit: Clicked the rotation link from wikipedia and saw this http://en.wikipedia.org/wiki/File:Ro...omposition.png
    If you learn this then you have done ur homework well!

  3. #78
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Given a buffer with a pointer to data + the size in bytes, what's a good algorithm to use to generate ID's. That can't possibly be that hard to understand.. well I don't think?
    Nah I understand that. What I didn't understand was all that positioning stuff using the camera.
    My scripts:
    Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
    Questions? I bet that for 98% of those, you'll find answer HERE

  4. #79
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by eska View Post
    Nah I understand that. What I didn't understand was all that positioning stuff using the camera.
    I was going to save that explanation for a tutorial. Only posted what I had in case someone understood what those matrices were.

    Camera rotation works like this:

    Projection Matrix defines the view/clipping area. That's basically how much you can see on the screen at one time. The distance you can see, etc.

    ModelView Matrix is two matrices combined. You use this + Projection matrices to convert from 2D to 3D and back. I've provided all the matrices needed to get the camera position but it simply isn't possible to reverse/split a matrix.

    Using the two matrices, by rotating, translating, inversing and transposing, it's possible to get the camera location and use that to get the look-at. Aka eye coordinates.

    Example: The model view is the view matrix + Model matrix combined. You cannot split them. If I could then I'd have camera position.

    Instead, I have to some how use the modelview matrix + projectionview matrix and hooks to get the camera position. I've already provided the source for all the hooks needed but still it puzzles me how anyone could possibly get the camera position. Now there is a program calld GLIntercept which has a plugin called FreeCam. This plugin is opensource and it is able to get the camera position by some insane mathematics. I've tried and given up on even bothering to understand it at this point in time. It's beyond matrices. It's called Quaternions.

    Anyway all the info needed to get camera position is what that post was showing. I didn't expect anyone to know what it was or just reverse it magically because that really really isn't possible (for me at least) atm. Lets just say the amount of math required atm isn't worth it for anyone to start learning from scratch. I admire game programmers now. The amount of work is ridiculous.

    The other stuff was just progress reports n stuff.

    I'm going to go bother benland for an algorithm or do some of research or something.
    Last edited by Brandon; 08-08-2012 at 10:19 PM.
    I am Ggzz..
    Hackintosher

  5. #80
    Join Date
    Feb 2007
    Location
    Switzerland
    Posts
    583
    Mentioned
    1 Post(s)
    Quoted
    50 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    I was going to save that explanation for a tutorial. Only posted what I had in case someone understood what those matrices were.

    Camera rotation works like this:

    Projection Matrix defines the view/clipping area. That's basically how much you can see on the screen at one time. The distance you can see, etc.

    ModelView Matrix is two matrices combined. You use this + Projection matrices to convert from 2D to 3D and back. I've provided all the matrices needed to get the camera position but it simply isn't possible to reverse/split a matrix.

    Using the two matrices, by rotating, translating, inversing and transposing, it's possible to get the camera location and use that to get the look-at. Aka eye coordinates.

    Example: The model view is the view matrix + Model matrix combined. You cannot split them. If I could then I'd have camera position.

    Instead, I have to some how use the modelview matrix + projectionview matrix and hooks to get the camera position. I've already provided the source for all the hooks needed but still it puzzles me how anyone could possibly get the camera position. Now there is a program calld GLIntercept which has a plugin called FreeCam. This plugin is opensource and it is able to get the camera position by some insane mathematics. I've tried and given up on even bothering to understand it at this point in time. It's beyond matrices. It's called Quaternions.

    Anyway all the info needed to get camera position is what that post was showing. I didn't expect anyone to know what it was or just reverse it magically because that really really isn't possible (for me at least) atm. Lets just say the amount of math required atm isn't worth it for anyone to start learning from scratch. I admire game programmers now. The amount of work is ridiculous.

    The other stuff was just progress reports n stuff.

    I'm going to go bother benland for an algorithm or do some of research or something.
    Correct me if I am wrong, but the only goal is to get the camera position? Quaternions don't seem to be that complicated, perhaps you should have a look at complex numbers in 2D. I am sure I could help with math, but I have no idea about hooking/interception. I just don't understand anything about pointers and ids you are talking about, tbh

  6. #81
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Gala View Post
    Correct me if I am wrong, but the only goal is to get the camera position? Quaternions don't seem to be that complicated, perhaps you should have a look at complex numbers in 2D. I am sure I could help with math, but I have no idea about hooking/interception. I just don't understand anything about pointers and ids you are talking about, tbh
    My goal atm is to just generate ID's for the models. As for the camera, well.. that's another story. It is hard. Try programming a class to rotate, transpose, translate, etc.. It's not the same as on pen and paper. Then also implementing it is another process. Yeah the goal was to get the position and look-at but I'm skipping that for now.

    Anyway I've written the Simba plugin. It works atm. Just not sure how to pass arrays to simba as it cannot read pointers -__-
    I am Ggzz..
    Hackintosher

  7. #82
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    456
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Hi Brandon

    Looking good mate!

    Just though I'd share my hook for getting compass angle. It's messy but very simple.

    I stripped silentwolf's version as a base for mine as I had trouble compiling yours. Anyway it should be easy enough to implement in your code.

    Code:
    // globals
    bool GettingCompassAngle;
    int CompassVertexCount;
    int CompassDeltaX;
    int CompassDeltaY;
    float CompassAngle = 0.;
    
    void sys_glBindTexture (GLenum target,  GLuint texture)
    {
    	// 0x84F5 = GL_TEXTURE_RECTANGLE
    	if(target == 0x84F5) {
    		GLint textureWidth, textureHeight;
    		glGetTexLevelParameteriv(GL_TEXTURE_RECTANGLE_ARB, 0, GL_TEXTURE_WIDTH, &textureWidth);
    		glGetTexLevelParameteriv(GL_TEXTURE_RECTANGLE_ARB, 0, GL_TEXTURE_HEIGHT, &textureHeight); 
    
    		if (textureWidth == 51) {
    			if (textureHeight == 51) {
    				//add_log("Found the compass %d", currentPossibleItem->texture_id);
    				GettingCompassAngle = true;
    				CompassVertexCount = 0;
    		   }
    		}
    ....
    
    void sys_glVertex2f (GLfloat x,  GLfloat y)
    {
    	if(GettingCompassAngle) {
    		if (CompassVertexCount == 0) {
    			CompassDeltaX = x;
    			CompassDeltaY = y;
    		}
    		if (CompassVertexCount == 3) {
    			CompassDeltaX = x - CompassDeltaX;
    			CompassDeltaY = y - CompassDeltaY;
    		}
    		CompassVertexCount++;
    	}
    ....
    
    void sys_glEnd (void)
    {
    	if(GettingCompassAngle) {
    		GettingCompassAngle = false;
    		CompassAngle = atan2f(CompassDeltaY, CompassDeltaX) * 180 / M_PI;
    		if (CompassAngle < 0)
    			CompassAngle = 360 + CompassAngle;
    		add_log("COMPASS ANGLE = %f", CompassAngle);
    	}
    ....
    EDIT: Sorry I didn't realize you'd already done this
    Last edited by ReadySteadyGo; 08-09-2012 at 03:01 PM.

  8. #83
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,691
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    This is great. Keep it up, I might join in if time permits me to.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  9. #84
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by ReadySteadyGo View Post
    Hi Brandon

    Looking good mate!

    Just though I'd share my hook for getting compass angle. It's messy but very simple.

    I stripped silentwolf's version as a base for mine as I had trouble compiling yours. Anyway it should be easy enough to implement in your code.

    Code:
    // globals
    bool GettingCompassAngle;
    ....
    EDIT: Sorry I didn't realize you'd already done this
    I just tried your code in a Copy of the dll just so that I don't mess up what I have, when your compass gets upside down, North facing south, your code resets it to 0.
    I am Ggzz..
    Hackintosher

  10. #85
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    456
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Makes sense

    Can be fixed by checking which vert is higher when CompassAngle = 0.

    Just stick with what you have if it works though

  11. #86
    Join Date
    Mar 2010
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Compass reset

    I haven't looked at the source but it's probably because textures are normally upside down, so 0 is south. Is the angle also 0 when facing north?

    I've also been working on a opengl bot for past few months. I'll make my own thread soon showing some of my stuff.

  12. #87
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by drizilc View Post
    I haven't looked at the source but it's probably because textures are normally upside down, so 0 is south. Is the angle also 0 when facing north?

    I've also been working on a opengl bot for past few months. I'll make my own thread soon showing some of my stuff.
    It's because his algorithm compared the change in slope. It needs to compare texture position to a static point. That way you can tell how much it has rotated. Then use the slope to get the angle which is what I did. I actually had to get pen and paper out to do it lol. Spent a while trying to figure out why it was doing that too
    I am Ggzz..
    Hackintosher

  13. #88
    Join Date
    Mar 2010
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Heh, everyone has their own way of doing things. My implementation was based on textures corner positions.


    Shared some of my stuff here http://villavu.com/forum/showthread.php?t=88235
    Last edited by drizilc; 08-09-2012 at 04:09 PM.

  14. #89
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Do you have to gather item id's? As in, when using OpenGL, you gather id's as you find them, then record them; or can you grab them all at once, and store them after grabbing them all at once. Obviously the 2nd way would be much faster, however I was wondering if the 2nd way is possible or if collecting id's needs to be done as in the first way. I may also be getting ahead of myself (;

Page 4 of 4 FirstFirst ... 234

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •