I'm new to psp development. i'm now using PSP 3.52M33 for development. recently i met a problem and cannot find solution with google. so pls somebody help
my code
Code: Select all
#define SCR_TEX_W 512
#define SCR_TEX_H 256
// Initializes the PSP Display.
void InitializeGraphics()
{
float ratio;
int _3dview_h;
//SDL_Surface *screen;
const SDL_VideoInfo* info = NULL;
/* Our angle of rotation. */
// The SDL screen surface
SDL_Surface *sdlscrn;
// fe2 UI blits are done to old screen memory and copied to this texture.
static unsigned int screen_tex;
// Set window size, I kept the original 1.6 ratio for now
int screen_w = 432;
int screen_h = 270;
if ( SDL_Init ( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0 ) {
printf( "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}
info = SDL_GetVideoInfo ();
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
if ((sdlscrn = SDL_SetVideoMode (screen_w, screen_h, info->vfmt->BitsPerPixel, SDL_OPENGL | SDL_DOUBLEBUF)) == 0) {
printf ("Video mode set failed: %s\n", SDL_GetError ());
SDL_Quit ();
exit (-1);
}
printf ("Video mode set ok");
_3dview_h = screen_h - (32*screen_h)/200;
ratio = (float) screen_w / (float) _3dview_h;
#if 1
glDisable (GL_CULL_FACE);
glShadeModel (GL_FLAT);
glDisable (GL_DEPTH_TEST);
glClearColor (0, 0, 0, 0);
glViewport (0, 32*screen_h/200, screen_w, _3dview_h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glEnable (GL_TEXTURE_2D);
glGenTextures (1, &screen_tex);
glBindTexture (GL_TEXTURE_2D, screen_tex);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, SCR_TEX_W, SCR_TEX_H, 0, GL_RGBA, GL_INT, 0);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable (GL_TEXTURE_2D);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
// Configure some SDL stuff
SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_ENABLE);
SDL_EventState(SDL_MOUSEBUTTONUP, SDL_ENABLE);
SDL_ShowCursor(SDL_ENABLE);
#endif
}
Code: Select all
psp-addr2line -e taget.elf -f -C 0x89298d8 0x5c30fc8a 0x89007e0
Code: Select all
psp-addr2line -e .elf -f -C 0x89298d8 0x5c30fc8a 0x89007e0
__pspgl_context_writereg
/media/windows/docs/psp/pspsvn/pspgl/pspgl_context.c:14
??
??:0
InitializeGraphics
??:0
I just wonder why the crash may happen? in fact i have already tried to add -DHAVE_OPENGL in both comiling makefiles(SDL and my application)
my makefile
Code: Select all
ROOT := $(shell pwd)
MODULE_OBJS =
ZOUT = $(ROOT)/zout
INCDIR += $(PSPSDK)/../include/GL
INCDIR += $(PSPSDK)/../../include/SDL
OBJS = main.o graphics.o menulogic.o kernel.o
LIBS += -lSDLmain -lSDL -lGL -lGLU -lglut -lpsprtc -lpspvfpu
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = UI
PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags) -DHAVE_OPENGL
LIBS += $(shell $(PSPBIN)/sdl-config --libs) -lm -lc -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpspvfpu -lpspuser -lpspkernel -lstdc++
include $(PSPSDK)/lib/build.mak
so , any solution?