Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

232 Neutral

About StratBoy61

  • Rank
  1. Hello raigan, Thank you for the tip but it is the first thing that I checked :-) I am going to try using alpha blending, because so far I have used the discard method in the fragment shader to manage transparency. I will also try to display more sprites at once, by using a VBO containing several sprites and update their textures coordinates and positions. I do not know if it is the best thing to do for each frame though, but I will try it out. Regards, stratboy61
  2. The sprites are 96x96 pixels. I do not have any performance issue so far (I am not displaying as many sprites as 3,000), but I am troubled with this flickering effect. It really looks like a vertical sync problem, as it is occasional. This is why it does not really make sense... Also, I do not understand why the flickering occurs only when the sprite is animated ; if I keep the same code, but rather than looping through the animations, I just keep on displaying say, the first pose, the flickering is no longer visible. Thanks for the hint though, I am going to test with sprites of other sizes. Regards, stratboy61
  3. Quote:Original post by mhagain If you're using GL_QUADS as your mode and GL_UNSIGNED_INT as your type you're not doing yourself any favours either. Switch to GL_TRIANGLES because it's native to the GPU so there's less possibility of it going through any software emulation steps first, and switch to GL_UNSIGNED_SHORT because it's more widely supported in hardware. Thank you mhagain for your answer. I am already using GL_TRIANGLE_STRIP with GL_UNSIGNED_SHORT ; I used the word "quad" to somehow emphasize the technique I used to display sprites. Okay, I will try to reduce the calls to glDrawElements ; I am glad to have a feedback about what is considered too much ;-) Any hint about the flickering ? I added glFlush and glFinish, but it does not change anything. Regards, stratboy61
  4. Hi there, I am writing a 2D engine, and I thought that I had got the right idea to use nothing but quads to draw sprites on. The thing is that I am experiencing two behaviors that got me decided to post this message on gamedev : - First, I can see some flickering, generally located on the last sprite drawn. I must say that I am using the OpenGL ES 2.0 reduced set, so all the drawings are made using glDrawElements() on a single quad. I am animating the sprite by changing the texture's coordinate in the vertex shader (I am using an atlas to store all the sprites' poses and I simply loop through them). Oddly enough, when I animate the sprites, I can see some of them flickering --usually the last drawn but not always, whereas everything is drawn smoothly when I do not animate. The only difference between *animating* and not animating is dynamically changing the texture's coordinate in the vertex shader... - Second, I was surprised to see that my frame rate goes down to 30FPS when I display 3,000 sprites. I assume that it is due to the number of call to glDrawElements(), because I can draw way more than 3,000 x 2 triangles in my 3D engine before seeing the FPS go down. But does it make sense that only 3,000 calls to glDrawElements() degrade so much the performances ? Could someone please tell me whether what I am doing is the right thing to do or not ? Does someone know where the flickering could be coming from ? I just noticed that if I turn GL_DEPTH_TEST on, the flickering tends to disappear !?!! Thank you in advance ! Cheers, stratboy61
  5. Hi there, I am developing a new project for the iPhone/iPad and I just started a small prototype that makes use of OpenAL. I chose OpenAL so that my prototype (written in C++) should hopefully run under Androïd, as well as any of the next devices from "put_name_of_new_company_here". First of all, if you already know that using OpenAL on the iPhone/iPad is crazy and should never be attempted, please let me know. So far, I had it at least play a sound :-) However, my main question is the following : In my game, there will be at least one soundtrack and some extra sounds. I assumed that the soundtrack would be a big .ogg file (that should last at least 10 minutes), and that the extra sounds would be .wav files. Does it make sense ? Now, I reviewed a tutorial about ogg and vorbis, in which the main .ogg file is streamed from disk and played on the fly. If it is the way to go (i.e streaming the .ogg file during the game rather than loading it in memory at startup), does it mean that most of the games out there have some special thread for processing the sounds and soundtrack ? I found out that the tutorial that I tried (which draws a simple OpenGL scene in a window while playing an .ogg file) crashes if I interrupt the program (that is, the streaming). For instance, if I click on the window's title bar to move it, the program is interrupted (at least under windows XP) and the .ogg file streaming goes awry (and never gets back on track). I assume that this problem could be fixed by creating a thread for the streaming, but before doing so, I thought that I had better ask :-) Please let me know if you have already experienced such issues, and if you know what is the correct way to go when one wants to manage several long soundtracks (on top of each others) and some extra sounds. Thank you in advance for your answers. Best regards, Stratboy61
  6. I had made a mistake while getting the Linux source code before I compiled it under windows. The good news is that there is no difference between OpenGL running under Linux or windows. I got the *right* version of the sources, recompiled them under windows, and saw with my own eyes that the demo looked the same ! Great ! Thanks again kRogue, as I now have my OpenGL drivers working on my Acer laptop. It is much less error prone to work when one can see the result of what one's compiling ! Cheers, Stratboy61
  7. Hey kRogue, Thank you for your answer. I could actually update my drivers and I can now run OpenGL 2.0 applications under windows on my laptop. I did not use the driverheaven drivers/utility per se, but I ended up downloading ati_omega_xp drivers and it worked just fine !! Now I can see the problem myself. The whole scene is very dark and there is no texture indeed. As for my friend's graphic card, I have not asked him yet. I am going to gather more information, simplify the scene and eventually/hopefully narrow down the problem. I might post my results here, if they interesting enough :) Thanks again. Rating ++. StratBoy61
  8. Hello all, Well, this might be a long shot in the dark, but I am currently facing a problem that I have a hard time tackling. A big problem that I have comes from the fact that my unique development machine (that has a dual boot win32/linux) is a laptop that does not have OpenGL 2.0 support under windows --and will probably never have (acer travelmate 8100). Strangely enough, OpenGL 2.0 works like a charm under my Fedora 4. My OpenGL demos work great, but I have no way of seeing them run under my win32 partition. I recently wanted to see what my GLSL shadowmap demo looked like under win32. I thus changed the code so that it starts under windows (mainly the main() prototype to change), sent my exe to a friend of mine who had OpenGL 2.0 drivers working under windows and looked forward for the results. I must add that I am using glew in order to have OpenGL 2.0 support. I am also using glut and DevIL. I shipped the libs with my exe. My friend could make it run, and glewIsSupported("GL_VERSION_2_0") returned okay on his machine (which is not the case on mine). Well, there is no shadow at all under windows. It even seems that there is not any textures either under windows (according to what my friend described). I am thinking that it might be a problem of FrameBuffer, but I have no way to debug the code right now. Hence my question : Are we expected to see discrepancies between a good working ole code under linux and the same code compiled for windows ? Is my problem already known ? If so, is there a workaround ? Thank you in advance for your answers. If this sounds very mysterious to all of you, I will make an effort and find some time to debug my code under a win32 plateform that has OpenGL 2.0 support. Cheers, StratBoy61
  9. StratBoy61

    [java] Java disadvantages

    I am surprised not to read anything about the *supposedly* Java multi-platform feature. I remember back in the years, where my Java program would behave differently depending on the JVM. Sometimes it would simply crash. I could not believe that nowadays the problem no longer exists. Anyways, I think that if one wants to create something such as a casual game, and is targeting different platforms, Java + a 3D accelerated library should be a good choice. There might be slight problems on different platforms, but it should be overcome for a game not too demanding. Now, if you target some specific environment, you might want to take the most specialized tool for it, with compiled code, that will not move/change. I believe that it is actually dangerous to be able to change a part of a program later on, like a library or JVM version, although it can sound attractive at the beginning. Some people see it as a plus... I assume it is because they have not got into the hassle yet ;) Cheers StratBoy61 [Edited by - StratBoy61 on April 26, 2007 2:20:50 PM]
  10. StratBoy61

    Saving a HBITMAP to a file...

    Hi there, If you are using C++, you might want to take a look at the code code below, that I found somewhere on the internet. It is been used like so : PBITMAPINFO pbi = CreateBitmapInfoStruct(0, hSomeBitmap); CreateBMPFile(0, "MyBitmap.bmp", pbi, hSomeBitmap, hdcMem3); void CreateBMPFile(HWND hwnd, LPTSTR pszFile, PBITMAPINFO pbi, HBITMAP hBMP, HDC hDC) { HANDLE hf; // file handle BITMAPFILEHEADER hdr; // bitmap file-header PBITMAPINFOHEADER pbih; // bitmap info-header LPBYTE lpBits; // memory pointer DWORD dwTotal; // total count of bytes DWORD cb; // incremental count of bytes BYTE *hp; // byte pointer DWORD dwTmp; pbih = (PBITMAPINFOHEADER) pbi; lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage); if (!lpBits) errhandler("GlobalAlloc", hwnd); // Retrieve the color table (RGBQUAD array) and the bits // (array of palette indices) from the DIB. if (!GetDIBits(hDC, hBMP, 0, (WORD) pbih->biHeight, lpBits, pbi, DIB_RGB_COLORS)) { errhandler("GetDIBits", hwnd); } // Create the .BMP file. hf = CreateFile(pszFile, GENERIC_READ | GENERIC_WRITE, (DWORD) 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL); if (hf == INVALID_HANDLE_VALUE) errhandler("CreateFile", hwnd); hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M" // Compute the size of the entire file. hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + pbih->biSize + pbih->biClrUsed * sizeof(RGBQUAD) + pbih->biSizeImage); hdr.bfReserved1 = 0; hdr.bfReserved2 = 0; // Compute the offset to the array of color indices. hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + pbih->biSize + pbih->biClrUsed * sizeof (RGBQUAD); // Copy the BITMAPFILEHEADER into the .BMP file. if (!WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER), (LPDWORD) &dwTmp, NULL) ) { errhandler("WriteFile", hwnd); } // Copy the BITMAPINFOHEADER and RGBQUAD array into the file. if (!WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD), (LPDWORD) &dwTmp, NULL)) errhandler("WriteFile", hwnd); // Copy the array of color indices into the .BMP file. dwTotal = cb = pbih->biSizeImage; hp = lpBits; if (!WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp,NULL)) errhandler("WriteFile", hwnd); // Close the .BMP file. if (!CloseHandle(hf)) errhandler("CloseHandle", hwnd); // Free memory. GlobalFree((HGLOBAL)lpBits); } PBITMAPINFO CreateBitmapInfoStruct(HWND hwnd, HBITMAP hBmp) { BITMAP bmp; PBITMAPINFO pbmi; WORD cClrBits; // Retrieve the bitmap color format, width, and height. if (!GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp)) errhandler("GetObject", hwnd); // Convert the color format to a count of bits. cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel); if (cClrBits == 1) cClrBits = 1; else if (cClrBits <= 4) cClrBits = 4; else if (cClrBits <= 8) cClrBits = 8; else if (cClrBits <= 16) cClrBits = 16; else if (cClrBits <= 24) cClrBits = 24; else cClrBits = 32; // Allocate memory for the BITMAPINFO structure. (This structure // contains a BITMAPINFOHEADER structure and an array of RGBQUAD // data structures.) if (cClrBits != 24) pbmi = (PBITMAPINFO) LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1<< cClrBits)); // There is no RGBQUAD array for the 24-bit-per-pixel format. else pbmi = (PBITMAPINFO) LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER)); // Initialize the fields in the BITMAPINFO structure. pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->bmiHeader.biWidth = bmp.bmWidth; pbmi->bmiHeader.biHeight = bmp.bmHeight; pbmi->bmiHeader.biPlanes = bmp.bmPlanes; pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel; if (cClrBits < 24) pbmi->bmiHeader.biClrUsed = (1<<cClrBits); // If the bitmap is not compressed, set the BI_RGB flag. pbmi->bmiHeader.biCompression = BI_RGB; // Compute the number of bytes in the array of color // indices and store the result in biSizeImage. // For Windows NT, the width must be DWORD aligned unless // the bitmap is RLE compressed. This example shows this. // For Windows 95/98/Me, the width must be WORD aligned unless the // bitmap is RLE compressed. pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8 * pbmi->bmiHeader.biHeight; // Set biClrImportant to 0, indicating that all of the // device colors are important. pbmi->bmiHeader.biClrImportant = 0; return pbmi; } Note that I did not include the code for errhandler. Cheers StratBoy61
  11. StratBoy61

    My DirectX ScreenSaver needs you !

    Thank you levjs for your feedback --at least I got one ! Quote:Original post by levjs 1. Not all penguins come with lanterns. Is that intentional? Kinda. DirectX 9 has a limit of 8 lights. And unfortunately, I am using DirectX lights for the tux's head torch. I thought about creating a dynamic lightmap and use it, so that each tux could have its own helmet, but it was too complicated (the current light is a SPOT, not a POINT). Quote:2. Leaving the text from the icons lying around makes the screensaver look very cluttered. I don't see the penguins doing anything with them. I would attache them to the icon pics, so they both get pushed. You are right. I actually wanted to show the physics engine, and I thought that the more cluttered, the better ;) I should offer the option to have the icon and text attached together. Quote:3. It's not very clear what the boy is doing(spawning new icons, right?), it took me quite a while and another person to figure out what he was doing. OMG ! I am soooo disapointed ;) So the 'boy' cannot be recognized, is that right ? Mmmm, I wanted that character to be highly identifiable, you know, like someone you would associate with Linux, computers, windows... ;) Yeah, he's supposed to replace the icons that fell from the desktop. Still need a little bit of work on that... What could I do so that people recognize that character (without explicitly naming him)? StratBoy61
  12. Hello all, I am 99% done with my DirectX 3D screensaver. I am mainly waiting for art work, but the code is there... Below are some pictures that should link you to the page where the installer can be downloaded. A video (6,446KB ZIP file) can be downloaded too. Could some of you please download the screensaver, install it and let me know mainly if it did *not* work on your machine ? If you experienced problems with it (program not starting, icons turning black, etc.), could you please check the debug options in the Readme.txt file, generate the debug traces files and send them over to me ? I am planning on a world release very soon ;) The screensaver will be completely free, obviously. There is a Paypal donation button already, for those who would feel charitable ;) The version you can evaluate today has minor known issues (the most visible one being the main character animation not looping correctly and missing a lantern), but maybe major unknown problems. I am expecting a lot from your feedback, so that I can target as many configurations as possible. I would like to make sure that once I am releasing the screensaver to a broader audience, it does not have *obvious* problems. Thanks a lot in advance. Cheers, StratBoy61
  13. StratBoy61

    HLSL issue/artifact ?

    Quote:Original post by Xeile When you create your Direct3DDevice, you can also specify the format the Depth Buffer. The default is indeed 16 bit, but you can also use DepthFormat.D24X8 (24 bits depthbuffer, 8 bits for other use) or DepthFormat.D32 (which is the 32 bits version). Look up the AutoDepthStencilFormat member of the PresentParameter structure.Thanks ! I am going to play with the parameters and check the result. What can be the impact on my demo, the fact that I change the AutoDepthStencilFormat ? I am actually going to check on the internet actually, but if you know by experience something that is not commonly discussed, I would be glad to get your feedback. Thanks StratBoy61
  14. StratBoy61

    HLSL issue/artifact ?

    Quote:Original post by Schrompf Try to increase Depth Buffer precision or lower the Far/Near plane ratio. If both is not an option, you'll have to live with it. BTW, why do you see the back faces of a model at all? Forgot to activate back face culling? Might be a hint that something else is wrong as well.Hey Schrompf, thank you for your answer. I did not use proper words to describe my problem. What appear are front sufaces that should actually be behind others. Not back faces, that was a word confusion. My culling is okay. When not set properly, the models appear kinda indide-out. What you describe as "flicker" is exactly what happens. How do I know whether the ZBuffer is 16 bits or not, and how do I increase the Depth Buffer precision ? Also, this seems to happen only when I use vertex shader. Thanks in advance. StratBoy61
  15. StratBoy61

    HLSL issue/artifact ?

    Quote:Original post by Nik02 What is the ratio of your near and far clipping distances? 2000 = D3DXMatrixPerspectiveLH(&matProj, 1.6f, 1.0f, 1.0f, 2000.0f) ?
  • 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!