# gpr1me

Member

18

122 Neutral

• Rank
Member
1. ## Trying to get constant speed

Thanks Zipster, that was exacly what i was looking for. Works perfeclty now :)
2. ## Trying to get constant speed

I am having some trouble figuring this out. Basically i have set up a bunch of predetermined positions on the map which i visit in some predinfined order. The camera follows the path specified. It will go to one position which i set by the center of the gluLookAt() function. The center is the direction my camera is moving. My move function is this: void Camera::MoveForward( void ) { eye.x += (center.x - eye.x) / step; //eye.y += (center.y - eye.y) / step; eye.z += (center.z - eye.z) / step; center.x += (center.x - eye.x) / step; //center.y += (center.y - eye.y) / step; center.z += (center.z - eye.z) / step; } I have commented out the y positions because i do not want it to change. A am also increasing the center position so the camera will not slow down when it gets near the position it's going to. Once it gets to that position i update the center to the next position and it continues. Now my problem is if i have say 3 positions (p1, p2, p3) i want to camera to go to. It will start at p1->p2->p3. And say the distance between p1 and p2 is 10 and the distance between p2 and p3 is 20. This means that the camera will move from p2 to p3 faster than it moved from p1 to p2. How should i fix this problem? I am thinking i should have the center position always a constant distance away from my eye position and in the direction of the next position on the map to visit. How would i do this?
3. ## Looking at a Specified Point

In my little game i want to be able to look at a specific point in my 3d scene. If my camera is at (0, 0, 0) and i want to be able to look at (10, 0, 20) how would i do this. I understand that i need to change the gluLookAt() function. Which basically sets the camera's (eye, center, up). The Eye is the location of the camera, center is the direction the camera is pointing and up is defining what up is. So would i have to do something like this? gluLookAt(0.0, 0.0, 0.0, 10.0, 0.0, 20.0, 0.0, 1.0, 0.0); This will Make eye.x = 0.0, eye.y = 0.0, eye.z = 0.0 center.x = 10.0, center.y = 0.0, center.z = 20.0 up.x = 0.0, up.y = 1.0, up.z = 0.0 That means the camera will be at the origin and looking at the point (10.0, 0.0, 20.0). Am i correct? So if i want to look at a specific point all i would have to do is change the center to that point?

I am using visual studio's 2005 and i am having a problem trying to run some code. The error says that fatal error LNK1104: cannot open file 'libc.lib' I have searched google and found alot of people had the same issue with VS.net 2005. But i did not find a solution that works for me. I tried to ignore libc.lib by adding it into: Project Properties->Configuration Properties->Linker->Input->Ignore Specific Library But if i add it there i get this error: error LNK2019: unresolved external symbol __iob referenced in function _output_message jpeg.lib I am guessing i am getting this error because jpeg.lib is looking for something defined in libc.lib. Is there a way around this?
5. ## Screen X Y Position change.

I want to be able to change the way OpenGL reads my screen coordinates. What i mean by this is: OpenGL reads the TOP LEFT of the opengl screen as X=0 and Y=0. Instead of that i would like it to read the MIDDLE MIDDLE as X=0 and Y=0. Basically i want it to be a cartesian coordinate system. If there a function for doing this or do i have to perform the calculation myself?
6. ## Pathfinding Suggestions

Yeah this is true. Well i have decided to manually place the waypoints and edges between them. For the weight of the edge it will be a combination of the distance (easy calculation) and the type of terrain.
7. ## Weird Problem

Wow, such a headache for that. Thanks alot for your help! i need to pass out now :S
8. ## Weird Problem

I have used textures before and now i am using the same code from a previous project i worked on but this time the code is not working. I am trying to load a .bmp file with this function: AUX_RGBImageRec* Map::LoadBMP(char *Filename) { FILE *File=NULL; if (!Filename) return NULL; File=fopen(Filename,"r"); if(File) { fclose(File); return auxDIBImageLoad(Filename); } return NULL; } Now in my previous project i have no problems. But now i copied this code over to my new project i get this error: error C2664: 'auxDIBImageLoadW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR' So when i cast the char* to a LPCWSTR i get linking errors. Im using visual studio .net 8. I have included glaux.h file and i can't seem to figure out what the difference is that makes it work in a one project and not in another project. If anyone had the same problem do you know what a solution might be?
9. ## Clicking an object with the mouse.

In my program i want to be able to make an object (like a plane made with a GL_QUAD) clickable. So if i have a plane displayed on the screen i want to be able to click on a point on the screen and get the X, Y position on the plane (not the screen). Is this some sort of collision detection or something? [Edited by - gpr1me on March 26, 2006 4:00:31 PM]
10. ## Pathfinding Suggestions

Yeah i am going to be using floyd warshall all-pair shortest path algorithm. Dijkstra's algorithm is good for finding the shortest path between two vertice's but floyds find the shortest path between every pair. And if there are a large number of edges in the graph (about the same number of edges as vertice's) then floyds algorithm is faster.
11. ## Pathfinding Suggestions

I am wrting a pathfinding program in OpenGL and i am having a little trouble as to how i want to respresent Waypoints on my map. I know i could use a simple A* algorithm but i wanted to try something different so i decided to try using Waypoints and an all-pair shortest path algorithm. Basically once my waypoints are positioned on my map i will be representing them as vertices in a graph and have weighted edges between them. After the graph is setup i will run an all-pair shortest path algorithm on my graph to get the shortest paths between each pair of vertice. This will all be pre-processed before the openGL window appears so it will be an extremely fast at run time. I just have to store a table in memory for this pre-processed solution. Ok so here is the point of this thread. I am not sure about how i will be making my waypoints. Right now i made a waypoint class and it stores an x, y position and has all the regular constructors and stuff like that. But should i position them manually or write an algorithm to do it. I was thinking just to place them like a certain distance away from eachother by running a simple double for loop. I wont place a waypoint if there is an obejct in that position already. And i will have auto placements of waypoints around each obejct that i place on the map (like rocks, tree's, mountains, ect...). I think this is a good solution but i just wanted to see if anyone can see downsides to this technique? Im sure it's not the best pathfinding technique out there but i think it will be fun to do. Any suggestions or comments would be great. Thanks
12. ## Dynamic Binding

Ok so in the merge function which is implemented in each class would i have to implement multiple merge functions for each derived class. For example: I would have in my SimpleClass: Project & Merge(SimpleClass *); // would return a minor project Project & Merge(MinorClass *); // would return a minor project Project & Merge(MajorClass *); // would return a major project In MinorProject: Project & Merge(SimpleClass *); // would return a minor project Project & Merge(MinorClass *); // would return a minor project Project & Merge(MajorClass *); // would return a major project In MajorProject: Project & Merge(SimpleClass *); // would return a major project Project & Merge(MinorClass *); // would return a major project Project & Merge(MajorClass *); // would return a major project Or would i only have to have one overrided function in each derived class?

14. ## Trouble with pointer to object.

Ok i understand what i was doing wrong. Im still getting the hang of pointers. Why do they have to teach just Java in my University! Anyways, thanks for your help dude!