Greetings.
I work on small engine common for both Windows/MacOS X/iPhone.
I think I found issue in latest SDL from SVN.
The test application does not render window to green color as expected -
it remains the black.
But if I will comment out SDL_CreateTextureFromSurface - rendering work
as expected.
I compiled it with the latest SDL & SDL_image on VS2008 SP1.
I updated SDL from SVN today.
My system is E5200 + Nvidia 8400GS with the latest stable Nvidia drivers.
May anyone to give me advice?
Test.png is the png file with alpha channel.
Thank you
#include “SDL.h”
#include “SDL_image.h”
#include <string.h>
int main(int argc, char** argv)
{
if (SDL_Init(SDL_INIT_EVERYTHING))
abort();
SDL_WindowID mWindowID = SDL_CreateWindow(“Test application”,
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
480, 320, SDL_WINDOW_SHOWN | SDL_OPENGL);
if (!mWindowID)
abort();
int opengl_index = -1;
//create OpenGL renderer
int driver_count = SDL_GetNumRenderDrivers();
for (int i=0; i<driver_count && opengl_index == -1; ++i)
{
SDL_RendererInfo info;
SDL_GetRenderDriverInfo(i, &info);
if (strcmp(info.name, “opengl”) == 0)
opengl_index = i;
}
if (opengl_index == -1)
abort();
if (SDL_CreateRenderer(mWindowID, opengl_index, 0))
abort();
//load the texture
SDL_Surface* texture_surface = IMG_Load(“test.png”);
if (!texture_surface)
abort();
//comment it out to let the render happen
SDL_TextureID texture = SDL_CreateTextureFromSurface(0, texture_surface);
if (!texture)
abort();
while (true)
{
SDL_Event _event;
while(SDL_PollEvent(&_event)) {
switch (_event.type)
{
case SDL_QUIT:
return 0;
case SDL_MOUSEMOTION:
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
break;
case SDL_MOUSEWHEEL:
break;
case SDL_KEYDOWN:
break;
case SDL_KEYUP:
break;
case SDL_TEXTINPUT:
break;
}
SDL_Rect rect;
rect.x = 0; rect.y = 0; rect.w = 480; rect.h = 320;
SDL_SetRenderDrawBlendMode(0);
SDL_SetRenderDrawColor(0,0,0,0xff);
SDL_RenderFill(&rect);
SDL_SetRenderDrawBlendMode(2);
SDL_SetRenderDrawColor(0,0xFF,0, 0x55);
SDL_RenderFill(&rect);
SDL_RenderPresent();
SDL_Delay(1);
}
}
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.png
Type: image/png
Size: 8268 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090113/46d1ba45/attachment.png