• Advertisement

Jack Sotac

  • Content count

  • Joined

  • Last visited

Community Reputation

528 Good

About Jack Sotac

  • Rank
  1. OpenGL glEnd error

    What error code does glGetError() return?
  2. rotozoomSurface() SDL_GFX

    Depending on the surface returned by rotozoomSurface(), it will be necessary to either set the color key with SDL_SetColorKey() or enable per-pixel alpha using SDL_SetAlpha() for that surface. This will allow the surface to be used on any background.
  3. Untitled

    A lot of AAA games are developed with consoles as the lead platform. So the static GUIs are often ported directly to the PC leaving a less than efficient experience for the player. That said, game genres like FPS and fighting games don't usually need more than buttons and sliders for either platform. MMO/RPG are probably the last bastion for configurable GUIs. Although it's nice to have them, I don't mind if they're not movable/sizable as long the layout still works.
  4. In texLoad() , before the SDL_BlitSurface(surface,0,full,0) statement, try putting in these lines: SDL_SetAlpha(surface, 0, 0); SDL_SetAlpha(full, 0, 0); If that doesn't work, then it's probably something further down the line. The SDL_HWSURFACE flag is pretty obsolete , it's better to use SDL_SWSURFACE for better future compatibility.
  5. [SDL] .bmp in memory...

    Yes, you can use SDL_rwops together with SDL_LoadBMP_RW() and easily load a bitmap image from memory. Rather than post code, I will just point you to this tutorial. Displaying a Bitmap from a Custom Resource File using SDL RWops
  6. What errors are you getting from SelectObject/BitBlt/DeleteObject? Please check all of them. Some GDI functions use GetLastError() to return extended error info. Make sure CopyWindowHDC() is only being called once. Anything interesting happening inside EraseSelf/DrawSelf? Log all major events and be creative in your debugging.
  7. Quote:Original post by gretty Are you saying that for every SelectObject or CreateCompatibleX() I need to then release the data by doing DeleteObject() & DeleteDC()? You will only want to delete objects that you created yourself. The object returned by SelectObject() may not be yours to delete. Instead of DeleteObject(), you will want to use SelectObject() to return the DC back to the way you found it. Think of DCs as limited shared resources that must be put back exactly the way you found them. Generally they're created just before they're needed and immediately freed afterwards. This allows other programs on the computer to successfully allocate DCs. init //create an object and a dc that the program owns myobject = createcompatiblebitmap() mydc = createcompatibledc() draw(windowdc) //attach bitmap to dc previousobject = selectobject(mydc,myobject) //draw using mydc //blit mydc to windowdc //cleanup, also releases any resource from the previous call selectobject(mydc,previousobject) close //free object and dc once the program is finished with them deletedc(mydc) deleteobject(myobject)
  8. It's been many years since I've worked with Win32 DCs but I'll give this one a go. From what I remember DCs (and GDIs in general) were a limited resource so there is probably a 'DC' leak somewhere in the program. Check the return values from all the Win32 functions. You may have just removed them from your post for brevity purposes and that's ok. A quick look at GraphicEngine :: ExecuteDrawLogic() and it looks like you're selecting objects into the DC without releasing them.[Edit]CopyWindowHDC() also. Think about SelectObject() as if your were allocating memory. It takes another paired call to SelectObject() to release that memory. Below I moved the BufferCanvas to the draw loop, it may work fine the way you have it. bool GraphicEngine :: ExecuteDrawLogic( HDC WindowHDC ) { // Post: Draw all 'Dirty' Objects onto window using Double Buffering (avoids // flicker affect). HDC BufferCanvas = CreateCompatibleDC(WindowHDC ); if(NULL == myHDC)return false;//Do this check for all the remaining win32 calls hMCBmpOld = SelectObject( BufferCanvas, hBlt ); // Draw objects onto Buffer Canvas while ( !DrawQueue.empty() ) { DrawQueue.front()-> EraseSelf( BufferCanvas ); DrawQueue.front()-> DrawSelf( BufferCanvas ); DrawQueue.pop(); } // Copy BufferCanvas HDC to WindowCanvas HDC BitBlt( WindowHDC, ClientRect.left, ClientRect.top, ClientRect.right, ClientRect.bottom, BufferCanvas, 0, 0, SRCCOPY ); SelectObject(BufferCanvas ,hMCBmpOld ); DeleteDC(BufferCanvas );//paired with CreateCompatibleDC() return true; } In the WindowProc callback timer handler,InvalidateRect() posts the WM_PAINT message to the window's message queue and UpdateWindow() calls the WindowProc directly with the WM_PAINT message. So it may not be necessary to call them both.
  9. Time's up!

    Congratulations on finishing the game. I've ran afoul the accursed Ninety-ninety rule many times also. This is the kind of project I like to follow when reading developer journals. I downloaded and compiled your project with only a few minor issues using VS2008 Express. I couldn't play much since it looks like the game wasn't meant for my 1440x900 screen:(
  10. Major problems with DevIL and FreeImage!

    For DevIL, it's supposed to have support wide strings, but see what happens if you change your settings and pass ilLoadImage a utf-8 string instead. For Freeimage, make sure OpenGL is interpreting the pixel data correctly when you pass the image data to it.
  11. SDL window locking up [SOLVED]

    Have you tried pumping SDL's event queue? while(1){ while ( SDL_PollEvent(&event) ) { ..Handle events } Draw(); }
  12. Try turning off SDL_SRCALPHA before calling SDL_BlitSurface so that you can do an ordinary opaque blit. SDL_SetAlpha(surface, 0, 0); SDL_SetAlpha(surface2, 0, 0);
  13. Have you checked google? Some of the time this is due to having different versions of the SDL dll on you system. Do a search for them on your system and make sure they match the version you're using in your program.
  14. SDL_Image related issues

    SDL can do pixel format conversions so you don't have to do them manually. Have you tried SDL_BlitSurface and just blitted the 8bit surface onto the 32bit one? Or even SDL_ConvertSurface will do if you need more flexibility.
  15. The data buffer needs to be large enough to hold the entire uncompressed version of the audio data. In a case where an OggVorbis file is only 5Mb on disk, a uncompressed version might be 25Mb. Since OpenAL can only handle uncompressed data, the buffer size must be adjusted to fit the entire uncompressed version of the sound data. Since you don't know the final size the uncompressed data will be, you have to guess. The SDK example uses only small buffers because that all it needs to smoothly stream decoded data into them and play them.
  • Advertisement