• Advertisement

delbogun

Member
  • Content count

    59
  • Joined

  • Last visited

Community Reputation

122 Neutral

About delbogun

  • Rank
    Member
  1. Rotate camera vector problem

    So GL_CULL_FACE will also skip polygons that are covered by other polygons? In that case I don't need to implement back-face culling. Could anyone else confirm that GL_CULL_FACE will only draw the polygons directly visible on the screen? If I turn off the GL_CULL_FACE command, it doesn't actually flicker, but switches between drawing the polygons facing the camera and the polygons facing the other side. Hard to explain what I mean... Thanks for all help
  2. Rotate camera vector problem

    Thanks.. but I probably used the wrong word. What I'm trying to do is to not render polygons that can't be seen from the view. For example a box have 6 squares. If the camera is looking streight on the box, only 1 of 6 squares is visible on the view, so I don't want to render those other 5 squares. The OpenGL function glEnable(GL_CULL_FACE) only stops rendering those polygons that are inside the box. Since OpenGL doesn't have world coordinates, I have to work with object coordinates. That's why I try to create a camera vector that I rotate together with the object. Is there a easier way?
  3. I'm trying to implement back-face culling. The problem is that the object flickers all the time when I rotate the object. I'm rotating the camera vector when I rotate the object. Then I use the dot product of that camera vector with the polygon's normal to be able to determine if I need to draw the polygon or not. The thing is that it seems to work fine if I don't rotate the camera vector, so I think that the rotation is wrong. This is how I rotate the camera vector: // Setup camera location gluLookAt(0,0,60,0,0,0,0,1,0); camera.x = 0; camera.y = 0; camera.z = 60; // Rotate camera vector around Y-axis int x = camera.x, z = camera.z; camera.x = x * cos(angle)+ z * sin(angle); camera.z = z * cos(angle)- x * sin(angle); // Rotate and draw the object glRotatef(angle,0,1,0); DrawObject(); Does anyone know a solution to my problem?
  4. Tetris AI

    Thanks Rixter, I understand it now. I was also trying to check the number of lines a certain position will destroy and place the block there, but that ended up with several holes instead. Your version is much better. Thanks again all :D
  5. Tetris AI

    Thanks alot edotorpedo, I'll try to implement your method. But I don't know if I understand your method correctly. My AI for the moment, weights the number of holes it makes and the lowest position possible. But that tends to make alot of I holes that only the I-block can save. Could you make a very simple example on one block that is dropped, so I can see how the numbers are retrieved and calculated?
  6. Tetris AI

    Yes, I meant an AI player for Tetris. I forgot to mention that :P Thanks for the help. I was thinking about that solution, to search for every possible move until I can make it fit somewhere. But it seem too far-fetched. I think I'll try with the minimax algorithm you suggested. So I need to store each possible move into the tree. Do I have to store the amount of blocks in a row that particular move affect, and then pick the move where the most blocks in a row is? Or something like that?
  7. Tetris AI

    Hi! I want to create a very simple Tetris AI. But I can't figure out a good enough algorithm. I've tried to search for known algorithms for this, but all documents I find seems to lead to one person (Colin Fahey), and his work can't even be found.. :( Does anyone have an algorithm, source or anything that can help me create a simple Tetris AI? Prefarable an algorithm that are simple to understand.
  8. I guess I'm screwed, but thanks alot for your help. I have no idea how to do the conversion myself. Doesn't that mean I have to know how IDirect3DSurface9 is built up? I could probably save the D3DSurface on a bitmap and then copy the bitmap to the buffer, but that would be too slow.
  9. How do I copy the content on a Direct3D surface to a custom buffer. Like the glReadPixels() does for OpenGL. I want to copy the data to a unsigned char* buffer. If I use IDirect3DDevice9::GetRenderTargetData or IDirect3DDevice9::GetBackBuffer the data have to be stored in a IDirect3DSurface9 object. Any tips on how I should do that? What I'm looking for is an Direct3D way to do this: unsigned char* buffer; glReadPixels(0,0,x,y,GL_RGBA,GL_UNSIGNED_BYTE,buffer);
  10. Hi! I want to create my own decoder for compressed audio. I guess OGG Vorbis is the best choice. Do anyone have a simple decoder with source code that can easily be read and understand? Or does anyone know or have a detailed document on how to implement it?
  • Advertisement