• Content count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About leggyguy

  • Rank
  1. Ok, this is really driving me batty. In visual C++ 2005 express, which I have been using for around a year, I compile everything using ctrl and F7, and that is nice. It compiles just what needs to be compiled, and nothing extra. If I haven't touched anything since the last compile, it knows it needs to compile almost nothing, so does a very quick compile. If I change an important file that everything else relies on, it compiles everything. This is the way it has always been, and I like it. Now, when I run the application using F5 or ctrl and F5, it builds everything, even though I compiled it just 20 seconds ago and nothing has changed. It didn't used to do this, or perhaps I was just using a different button to run my compiled program, and I just forgot what it was after my holidays. I used to press something (could have sworn it was F5) and it just up and ran if it was already compiled. What am I doing wrong? Something stupid, I am sure. Appreciate any help, thanks.
  2. Rotating around a point (2d)

    Bah I solved it, I was updating variables then using them again as though they were unchanged. Sorry to waste time :)
  3. Rotating around a point (2d)

    Scratcg this post, I didn;t describe the problem well. Basically my rotation isn;t working how I expect it to. [Edited by - leggyguy on September 13, 2006 3:51:15 PM]
  4. Rotating around a point (2d)

    I am using C++ and opengl. I'll try googling again. I did find this: x' = cos(theta)* x - sin(theta)*y; y' = sin(theta)* x + cos(theta)*y; Now when I use that, the line I am drawing is not where it is supposed to be. I am guessing then that that formula uses radians rather than degrees. [Edited by - leggyguy on September 13, 2006 2:25:40 PM]
  5. Hi. I have searched the forums, and found all sorts of help on rotating around a point, but I think I have confused myself. I have a point A at (2.0f, 0.0f, 3.0f) and point B at (3.5f, 3.0f, 3.0f). Notice that the z is the same, and will always stay the same. I want to find the point if I rotated B around A by x degrees, so that it is the same distance from A as it was before, but x degrees clockwise. Now, I know this is easy for some of you guys, but I have foxed myself by looking at all the 3d implementations, and I want need something simpler (I think) as the Z will always be the same. If anyone could provide a real quick snipet that helps I would appreciate the help. I know this is something I learnt at school, but damn if it isn't a long time since I was at school :)
  6. OpenGL Learning GLSL or CG

    Thanks for that book link, Herr_O. It does look good. I may buy it. But I am still looking for good pointers from anyone else who knows a site with great info.
  7. Could anyone point me towards really good GLSL tutorials? Or CG? I found cgshaders.org is no longer active, and I am wondering if the community went somewhere else, or simply stopped existing. I have been programming for a while, and managed to teach myself C++ and openGL from the odd book, but mostly online sources, especially for Opengl with well written tutorials over at Gametutorials and Nehe. Now I am at the stage where I need to learn GLSL in order to go further with Opengl, but I am struggling to find GLSL online info that goes further than lighting and shadows. There is quite alot of raw info out there, with quite technical data, but I have always found tutorials that do something, and explain how they did it, to be the best way for me to learn. But anything more than the lighthouse would be really welcome. Could anyone point me to where I need to be? I have googled, but the results are not too great, and we all know google often miss the best sites :)
  8. OpenGL Odd mouse input readings

    No reply I see. Yeh, this is a tough one I guess, no-one else knows either. Guess I'll have to leave that problem for another time . . .
  9. I am cerating an interface for my OpenGL game, where people can drag things around. For now I am just using regular winproc messages, but eventually will use directinput. But I want to get everything working now, so I will ask the question. I want to draw the selected interface item starting where the mouse is, so in winproc I do: int mousex = LOWORD(lParam); int mousey = HIWORD(lParam); mx = mousex; my = mousey; then I drew my selected interface item starting at mx by my. Which worked, until I got near the edge of my window. At which point the mouse pointer continued towards the edge, but the drawn item went to somewhere towards the middle of the window. Obviously, the item as not being drawn at the mouse position on those occasions. So to test it, I have my wondow now riting in the title box at the top the value of mx and my. They give the correct figures until the mouse gets to 33 pixels from the top. Then my suddenly has 512 in it until the cursor returns to 33 or more pixels from the top of the window. mx works the same way, once it gets to around 12 pixels from the left of the window, mx holds a figure which appears to be the distance of the window's left side from the left of the screen (so if I drag the window 200 px from the left of the screen, mx holds 200 once I get to around 11 pixels from the left of the window. I am really puzzled by why this is occuring, and really need to fix it, so that no matter where the mouse is within the window, mx and my have the correct figures. I appreciate any help. (I realize this isn't really an opengl problem, but I couldn't actually find the old win 32 sub-forum, I am most likely blind)
  10. Hi, I have a program, and I have enabled text by using a system I found on here a while ago. I load in a font bitmap to create a font in the constructor, and build the font in BuildFont, and then call the glPrint function when I want something written to screen. It works great when I need to write something in white, but I want to write in black. I have messed around with glBlendFunc arguments, and can't get it to work. I tried a font bitmap where the letters are almost black, but they are being drawn with a very low opacity with some glBlendFunc options, and not at all with others. Here is my code: TextBlitter::TextBlitter() { CreateTexture(MainTexture, "Font.bmp", 0, false); // Load font bmp } void TextBlitter::BuildFont () { float cx; // Holds Our X Character Coord float cy; // Holds Our Y Character Coord base=glGenLists(256); // Creating 256 Display Lists glBindTexture(GL_TEXTURE_2D, MainTexture[0]); // Select Our Font Texture for (int loop=0; loop<256; loop++) // Loop Through All 256 Lists { cx=float(loop%16)/16.0f; // X Position Of Current Character cy=float(loop/16)/16.0f; // Y Position Of Current Character glNewList(base+loop,GL_COMPILE); // Start Building A List glBegin(GL_QUADS); // Use A Quad For Each Character glTexCoord2f(cx,1-cy-0.0625f); // Texture Coord (Bottom Left) glVertex2i(0,0); // Vertex Coord (Bottom Left) glTexCoord2f(cx+0.0625f,1-cy-0.0625f); // Texture Coord (Bottom Right) glVertex2i(16,0); // Vertex Coord (Bottom Right) glTexCoord2f(cx+0.0625f,1-cy); // Texture Coord (Top Right) glVertex2i(16,16); // Vertex Coord (Top Right) glTexCoord2f(cx,1-cy); // Texture Coord (Top Left) glVertex2i(0,16); // Vertex Coord (Top Left) glEnd(); // Done Building Our Quad (Character) glTranslated(10,0,0); // Move To The Right Of The Character glEndList(); // Done Building The Display List } } void TextBlitter::glPrint(GLint x, GLint y, float dim, float r, float g, float b, char *string, int set) // Where The Printing Happens { if (set>1) set=1; glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); glBindTexture(GL_TEXTURE_2D, MainTexture[0]); // Select Our Font Texture glDisable(GL_DEPTH_TEST); // Disables Depth Testing glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPushMatrix(); // Store The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix glOrtho(0,1024,0,768,-1,1); // Set Up An Ortho Screen glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); // Store The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix glTranslated(x,y,0); // Position The Text (0,0 - Bottom Left) glListBase(base-32+(128*set)); // Choose The Font Set (0 or 1) glColor3f(r,g,b); glScalef(dim,dim,dim); glCallLists(strlen(string),GL_BYTE,string); // Write The Text To The Screen glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPopMatrix(); // Restore The Old Projection Matrix glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPopMatrix(); // Restore The Old Projection Matrix glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDisable(GL_BLEND); glColor3f(1,1,1); } I tried setting the r, g, b to low numbers, and the text simply vecame transparent rather than black. I'm stuck. I would appreciate any advice.
  11. OpenGL Blurry textures

    Thanks, the texture size is the same size as the application window, 1024x768. I shall have to recreate my textures, but this has fixed the problem save for a rearrange being in order.
  12. Hi, I wonder if anyone can help. I have created a texture in photoshop which I am going to use as a background. For now, I have gone into Ortho mode and drawn the texture to cover the entire screen. The sizing is perfect, but when I compare the two images (the image in photoshop and the image within the program I created) I notice the image in the game is not as crisp. Here is the difference: http://imagesocket.com/view/compare7e6.png As you can see the rightmsot is blurry, and not like the image I had in photoshop. Here is the code I am using to load the image, is there anything wrong with it? Or do I need to do something else to make my texture as crisp as it is in photoshop? This is a 2d application, and I need the image within it to be as good in quality as it is in photoshop. Speed isn't too important. AUX_RGBImageRec *pBitmap = NULL; //if(!strFileName) // Return from the function if no file name was passed in // return; pBitmap = auxDIBImageLoad(strFileName.c_str() ); // Load the bitmap and store the data if(pBitmap == NULL) // If we can't load the file, quit! exit(0); // Generate a texture with the associative texture ID stored in the array glGenTextures(1, &textureArray[textureID]); // This sets the alignment requirements for the start of each pixel row in memory. glPixelStorei (GL_UNPACK_ALIGNMENT, 1); // Bind the texture to the texture arrays index and init the texture glBindTexture(GL_TEXTURE_2D, textureArray[textureID]); // Build Mipmaps (builds different versions of the picture for distances - looks better) gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data); // Lastly, we need to tell OpenGL the quality of our texture map. GL_LINEAR_MIPMAP_LINEAR // is the smoothest. GL_LINEAR_MIPMAP_NEAREST is faster than GL_LINEAR_MIPMAP_LINEAR, // but looks blochy and pixilated. Good for slower computers though. glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
  13. I have gone through the nehe and gametutorials particle tutorials, and they are fine for the basics. But they don't help you make the particle system look good in a real situation. Using their techniques in my little 3d engine, I can see the alpha parts of the particles when they are over other particles. I understand that if I sort my particles, this should be solved. But no tutorials I have found actually explain how to do this. how do I determine which particle is furthest from the camera? How do I then sort them in such a way to keep everything as fast as possible, with 800 particles in each of my space craft's thrusters, is there a sort which is fast enough to not slow everything down? I have used disabling depth testing, and everything looks nice then, but of course I can see the particles through my geometry in that case, and that destroys any use it has. Has anyone done this before and can explain it, or better yet have a tutorial they can point me to?
  14. I am creating a thruster for my spaceship using particles. I have the xyz describing the center of the emitter [cvector emitterPos]. The xyz which is the direction the thruster is pointing and the particles should be heading [cvector direction]. Also I have a float radius of the engine [float coneRadius]. The idea is particles are created at a rondom point on the base of a cone which is based at the emitter [emitterPos] with the pointy tip part of the cone being [direction]. So the bottom round part of the cone is centered at emitterPos, with a radius of float coneRadius. If you follow that, how do I ascertain a random point on that circle plane with is at the base of the cone? I need to position my particles at this random base position once it dies and needs to be recreated. Any help with this is appreciated, I can't quite work it out in my head.
  15. Thanks guys. Yep I used combatwombat's method before I got to read your post, Hap. It works fine, and using the normal makes so much sense, I feel mad I didn't think of it. I was thinking it was so much more complicated. Thanks for the help.