Advertisement Jump to content
  • Advertisement

ma_hty

Member
  • Content Count

    323
  • Joined

  • Last visited

Community Reputation

100 Neutral

About ma_hty

  • Rank
    Member
  1. ma_hty

    Problem restarting glutmainloop

    glutMainLoop() will not end normally. It is designed to behave this way. There is nothing your can do to change this behavior. The license of glut forbids you from modifying the behavior of glut. If the behavior of glutMainLoop() bothered you too much, there are some variant of glut available, e.g. freeglut library.
  2. ma_hty

    Orthonormalize Two Vectors

    Quote:Original post by Petry ... why you were wanting to do this, ... There are a number of 3D rendering algorithms that depend on local coordinates system explicitly, e.g. dynamic bump mapping and anisotropic lighting (e.g. WARD lighting model). For a 3D model, the normals and the tangents are defined at vertices and are interpolated for the pixel operations. Although vertex normal and vertex tangent are orthonormal to each other, the interpolated normal and tangent are not orthonormal in general. So, when we try to form a local coordinates system using the interpolated normals and tangents, we need to make them orthonormal first. By the way, we have a well-known solution for it already, i.e. Gram-Schmidt Orthonormalization, which was mentioned by Apatriarca along with source code.
  3. ma_hty

    Normal Map for a Sphere

    I think your normal map is just fine. Are you using MIP mapping for your normal map? If so, please disable it. The way you generate your normal map making it not suitable for MIP mapping.
  4. Quote:Original post by Karmux 1) 64 vertices ~ 260 fps 2) 256 vertices ~ 250 fps 3) 1 024 vertices ~ 230 fps 4) 4 096 vertices ~ 200 fps ... This numbers probably have problem. I don't have a Intel 4500MHD display card. So, I'm not quite sure whether its performance is really that bad. However, let me give you a number on my Nvidia Geforce 8800 GTX display card (though it is already an outdated hardware nowadays). If I'm drawing a very simple teapot (around 300 vertex) with per-fragment lighting covering a screen of resolution 512x512, the frame rate is more than 10000 fps. (Before you ask. No, it is not typo mistake. It is really ten thousands fps. ) By the way, when you measure frame rates, please remember you need to do two things correct, i.e. 1) disable Vsync 2) call glFinish() at the end of each frame.
  5. Quote:Original post by Karmux My render() function renders all display lists compiled during draw() function. If I set textures before glNewList() then I have no textures.... . Are you calling draw() every frame? If so, you have made a big mistake. You should compile your displaylist at the beginning of your program once only. By the way, your texture loading function looks funny. ilInit(); ilGenImages(1, &Image); ilBindImage(Image); Texture = ilLoadImage(File.c_str()); glGenTextures(1, &Texture); // ... glDeleteTextures(1, &Texture); //<< here is the funny instruction Why are you deleting your texture right after it initialized? If you loaded your textures like this while still have something rendered correctly, it would be really mysterious.
  6. Try the following function. It saves the current screen in a .ppm file. void save_screen( const char *spath ) { GLint vp[4]; glGetIntegerv( GL_VIEWPORT, vp ); int x,y, w,h; x = vp[0]; y = vp[1]; w = vp[2]; h = vp[3]; int j; unsigned char *bottomup_pixel = (unsigned char *) malloc( w*h*3*sizeof(unsigned char) ); unsigned char *topdown_pixel = (unsigned char *) malloc( w*h*3*sizeof(unsigned char) ); //Byte alignment (that is, no alignment) glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels( x, y, w, h, GL_RGB, GL_UNSIGNED_BYTE, bottomup_pixel); for( j=0; j<h; j++ ) memcpy( &topdown_pixel[j*w*3], &bottomup_pixel[(h-j-1)*w*3], w*3*sizeof(unsigned char) ); FILE *f0 = fopen( spath, "wb" ); if( f0==NULL ) { printf( "[Error] : SaveScreen(), Cannot open %s for writting.\n", spath ); exit(-1); } fprintf( f0, "P6\n%d %d\n255\n", w, h); fwrite( topdown_pixel, sizeof(unsigned char), w*h*3, f0); fclose( f0 ); free(bottomup_pixel); free(topdown_pixel); }
  7. what do you mean by "indexing 3D textures"? There is no hardware support for palette texture. So, if you are talking about palette texture, a black outcome is normal.
  8. ma_hty

    Zoom In OpenGL

    It is wrong to do zooming by changing FOV (let alone changing eye position). Instead, you should use gluPickMatrix(). The reason will become obvious when you magnify the screen by a large scale by changing FOV. http://www.gamedev.net/community/forums/topic.asp?topic_id=465063
  9. ma_hty

    Zoom In OpenGL

    You can use glpickmatrix instead, check this out. http://www.gamedev.net/community/forums/topic.asp?topic_id=465063
  10. ma_hty

    OpenGL Frame Rate

    Quote:Original post by Trienco ... Sure you can disable that for testing or benchmarking, but at 1000fps you end up with seeing 16 horizontal stripes of 16 different frames because you swap out the framebuffer right under the monitors a.. backside. ... It is incorrect to measure framerate (benchmarking) by simply turn off Vsync. The framerate measured this way didn't not take into account the more demanding graphics operation. Lets put it this way. The OpenGL command you called would not be executed immediately at the time you call it. Instead, it is buffered. If you try to test the framerate by simply turn off Vsync, you measure the time taken to upload the OpenGL command to the buffer only. You can verity this problem very easily. You draw a full screen quad with Vsync ON and do something fancy in the fragment shader which lowered the framerate well below 60 fps. Afterward, you turn off Vsync and measure the framerate again. You will find that the lateral case took no time to complete, which is simply not reflecting the fact at all.
  11. ma_hty

    OpenGL Frame Rate

    Quote:Original post by Sigvatr Yeah, I'm going to thread my code so I don't swap back buffers until an entire new one is completed rendering, so I can do manual a Vsync and have the rest of my game code in it's own thread. Using different threads for logic routine and graphics routine is the right way to go. However, you shouldn't turn off Vsync if you are using this approach. Instead, you should leave Vsync enabled. Just in case you doesn't notice. if your program behaves correctly, its window will not be redrew unless a portion of the window is changing from invisible state to visible state or you tell it to do so explicitly. So, if you don't want the window to be redrew, you just need to stop firing redraw command. Turning off Vsync is only useful for the lazy guy who want to implement both logic routine and graphics routine within a single thread. However, the flaws of this lazy approach is simply too obvious to be tolerated. (At least, I won't forgive.)
  12. Quote:Original post by tomva ... "https://sourceforge.net/projects/aesop-mgf/">AESOP ... Oh, you are using sourceforge.net to host your project. Can you tell me how to change the project website? I'm trying to change the project website of my project for a long time. ( I'm still trying now.)
  13. What do you mean by "inverted" precisely? If you are trying to say the texture is vertically flipped, it might be caused by your image loading routine. In this case, the image loading routine stores its image data using top-down scanline.
  14. ma_hty

    Gimbal lock explanation on wikipedia

    Euler angles represent a rotation by using three angles from three axises. The criteria of these axises is quite loose actually. As long as the consecutive axises are not parallel to each other (not necessarily orthogonal), they can be used as the axises of Euler angles. That's why we have some funny Euler angles conventions like ZYZ. Depending on the applications, we have quite a lot of different Euler angles conventions. Check this out at http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm. Of course, all of them are suffered from gimbal lock problem. [Edited by - ma_hty on September 3, 2009 5:04:04 AM]
  15. ma_hty

    Angle between two 2D points

    Quote:Original post by _Sauce_ ... I'm simply clearing up what someone else said. When referring to one point / vector, the language is completely unanmbigious. ... This is ambiguous except for vectors in a 2D space with x-axis and y-axis. In this exceptional case, the angle of a vector is measured from positive x-axis conventionally.
  • 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!