Help compiling with PSPGL

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Help compiling with PSPGL

Post by JesusXP »

Hi Guys...

I'm trying to get the first (2nd) of NeHe's OpenGL tutorials, to compile for PSP, using the PSPGL libs... Right now I will post my Code, Makefile, and compiling error. I have been unable to find a tutorial on this, so as of right now, I'm just winging it, and I hope to write some sort of documentation about this in the future so any help is much appreciated.

main.c

Code: Select all

/* An attempt at OpenGL on the PSP */

#include<pspkernel.h>
#include<pspdebug.h>
#include<pspdisplay.h>
#include<pspctrl.h>
#include<pspgu.h>
#include<stdio.h>
#include<GL/gl.h>
#include<GL/glu.h>
#include<GL/glut.h>
#include<GL/glext.h>

int i = 0;
int window;

PSP_MODULE_INFO&#40;"PSPGL Example",0,1,1&#41;;

#define printf pspDebugScreenPrintf

/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;&#123;
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;&#123;
	int cbid;
	
	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;
	
	sceKernelSleepThreadCB&#40;&#41;;
	
	return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;&#123;
	int thid = 0;
	
	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41;&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;
	
	return thid;
&#125;

void ReSizeGLScene&#40;GLsizei width, GLsizei height&#41;&#123;
	if&#40;height == 0&#41;&#123;
		height=1;
	&#125;
	glViewport&#40;0, 0, width, height&#41;;//Reset the Current Viewport
	glMatrixMode&#40;GL_PROJECTION&#41;;	//select the Projection Maxtrix
	glLoadIdentity&#40;&#41;;		//Reset the Projection Matrix
	
	// Calculate the Aspect Ratio of the Window
	gluPerspective&#40;45.0f,&#40;GLfloat&#41;width/&#40;GLfloat&#41;height,0.1f,100.0f&#41;;
	glMatrixMode&#40;GL_MODELVIEW&#41;;	//Select the Modelview Matrix
	//glLoadIdentity&#40;&#41;;		//Reset the Modelview Matrix
&#125;

int InitGL&#40;int Width, int Height&#41;&#123;	//Setup for OpenGL goes here
	glShadeModel&#40;GL_SMOOTH&#41;; //enable smooth shading
	glClearColor&#40;0.0f, 0.0f, 0.0f, 0.0f&#41;; //Black Background
	glClearDepth&#40;1.0f&#41;;	//depth bugger setup
	glEnable&#40;GL_DEPTH_TEST&#41;; //enables Depth Testing
	glDepthFunc&#40;GL_LEQUAL&#41;; //the type of depth test to do
	//glHint&#40;GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST&#41;; //really nice perspective calculations
	
	glMatrixMode&#40;GL_VIEW_PSP&#41;;
	glLoadIdentity&#40;&#41;;				// Reset The Projection Matrix

	gluPerspective&#40;45.0f,&#40;GLfloat&#41;Width/&#40;GLfloat&#41;Height,0.1f,100.0f&#41;;	// Calculate The Aspect Ratio Of The Window
	glMatrixMode&#40;GL_VIEW_PSP&#41;;
//	return TRUE; //initialization went ok
&#125;

int DrawGLScene&#40;GLvoid&#41;&#123; //Here's where we do all the drawing
	glClear&#40;GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT&#41;;	//clear the screen and the depth buffer
	glLoadIdentity&#40;&#41;;	//reset the current modelview matrix
	glTranslatef&#40;-1.5f,0.0f,-6.0f&#41;; //move left 1.5 units and into the screen 6.0
	
	glBegin&#40;GL_TRIANGLES&#41;;
		glVertex3f&#40; 0.0f, 1.0f, 0.0f&#41;;	//top
		glVertex3f&#40;-1.0f,-1.0f, 0.0f&#41;;  //bottom left
		glVertex3f&#40; 1.0f,-1.0f, 0.0f&#41;;  //bottom right
	glEnd&#40;&#41;;
	
	glTranslatef&#40;3.0f,0.0f,0.0f&#41;; //move right 3 units
	
	glBegin&#40;GL_QUADS&#41;;
		glVertex3f&#40;-1.0f, 1.0f, 0.0f&#41;;
		glVertex3f&#40; 1.0f, 1.0f, 0.0f&#41;;
		glVertex3f&#40; 1.0f,-1.0f, 0.0f&#41;;
		glVertex3f&#40;-1.0f,-1.0f, 0.0f&#41;;
	glEnd&#40;&#41;;
	
	glutSwapBuffers&#40;&#41;;
	//return TRUE;	//Everything went ok
&#125;

int main&#40;int argc, char **argv&#41;&#123;
	
	pspDebugScreenInit&#40;&#41;;
	SetupCallbacks&#40;&#41;;
	glutInit&#40;&argc, argv&#41;;
	
	/* Select type of Display mode&#58;   
     	Double buffer 
     	RGBA color
     	Alpha components supported 
     	Depth buffer */  
  	glutInitDisplayMode&#40;GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH&#41;;  

  	/* get a 640 x 480 window */
  	glutInitWindowSize&#40;480, 272&#41;;  

  	/* the window starts at the upper left corner of the screen */
  	glutInitWindowPosition&#40;0, 0&#41;;  

  	/* Open a window */  
  	window = glutCreateWindow&#40;"Jeff Molofee's GL Code Tutorial ... NeHe '99"&#41;;  

  	/* Register the function to do all our OpenGL drawing. */
  	glutDisplayFunc&#40;&DrawGLScene&#41;;  

  	/* Go fullscreen.  This is as soon as possible. */
  	glutFullScreen&#40;&#41;;

  	/* Even if there are no events, redraw our gl scene. */
  	glutIdleFunc&#40;&DrawGLScene&#41;;

  	/* Register the function called when our window is resized. */
  	glutReshapeFunc&#40;&ReSizeGLScene&#41;;

  	/* Register the function called when the keyboard is pressed. */
  	
  	/* Initialize our window. */
  	InitGL&#40;480, 272&#41;;
  
  	/* Start Event Processing Engine */  
  	glutMainLoop&#40;&#41;;  
  	
  	while&#40;1&#41;&#123;
  		pspDebugScreenClear&#40;&#41;;
  		
  		for&#40;i=0; i<5; i++&#41; &#123;
                	sceDisplayWaitVblankStart&#40;&#41;;
          	&#125; 
  	&#125;
		
	sceKernelSleepThread&#40;&#41;;
	//destroy gl Window
	glutDestroyWindow&#40;window&#41;; 
	return 0;
&#125;
	

Makefile

Code: Select all

TARGET = pspgl
OBJS = main.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LIBS = -lpspgu -pspgl -lz -lm
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Image Example

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Error

Code: Select all

linux&#58;/home/jesusxp/development/psp/projects/gl_ex # make kxploit
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o main.c
main.c&#58; In function ‘main’&#58;
main.c&#58;128&#58; warning&#58; passing argument 1 of ‘glutDisplayFunc’ from incompatible pointer type
main.c&#58;134&#58; warning&#58; passing argument 1 of ‘glutIdleFunc’ from incompatible pointer type
main.c&#58; In function ‘InitGL’&#58;
main.c&#58;79&#58; warning&#58; control reaches end of non-void function
main.c&#58; In function ‘DrawGLScene’&#58;
main.c&#58;103&#58; warning&#58; control reaches end of non-void function
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lpspgu -pspgl -lz -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o pspgl.elf
psp-gcc&#58; unrecognized option '-pspgl'
main.o&#58; In function `ReSizeGLScene'&#58;
main.c&#58;&#40;.text+0xf0&#41;&#58; undefined reference to `glViewport'
main.c&#58;&#40;.text+0xf8&#41;&#58; undefined reference to `glMatrixMode'
main.c&#58;&#40;.text+0x100&#41;&#58; undefined reference to `glLoadIdentity'
main.c&#58;&#40;.text+0x144&#41;&#58; undefined reference to `gluPerspective'
main.c&#58;&#40;.text+0x15c&#41;&#58; undefined reference to `glMatrixMode'
main.c&#58;&#40;.text+0x178&#41;&#58; undefined reference to `glViewport'
main.c&#58;&#40;.text+0x180&#41;&#58; undefined reference to `glMatrixMode'
main.c&#58;&#40;.text+0x188&#41;&#58; undefined reference to `glLoadIdentity'
main.c&#58;&#40;.text+0x1cc&#41;&#58; undefined reference to `gluPerspective'
main.c&#58;&#40;.text+0x1e4&#41;&#58; undefined reference to `glMatrixMode'
main.o&#58; In function `InitGL'&#58;
main.c&#58;&#40;.text+0x208&#41;&#58; undefined reference to `glShadeModel'
main.c&#58;&#40;.text+0x220&#41;&#58; undefined reference to `glClearColor'
main.c&#58;&#40;.text+0x230&#41;&#58; undefined reference to `glClearDepth'
main.c&#58;&#40;.text+0x238&#41;&#58; undefined reference to `glEnable'
main.c&#58;&#40;.text+0x240&#41;&#58; undefined reference to `glDepthFunc'
main.c&#58;&#40;.text+0x248&#41;&#58; undefined reference to `glMatrixMode'
main.c&#58;&#40;.text+0x250&#41;&#58; undefined reference to `glLoadIdentity'
main.c&#58;&#40;.text+0x290&#41;&#58; undefined reference to `gluPerspective'
main.c&#58;&#40;.text+0x2ac&#41;&#58; undefined reference to `glMatrixMode'
main.o&#58; In function `DrawGLScene'&#58;
main.c&#58;&#40;.text+0x2c4&#41;&#58; undefined reference to `glClear'
main.c&#58;&#40;.text+0x2cc&#41;&#58; undefined reference to `glLoadIdentity'
main.c&#58;&#40;.text+0x2e4&#41;&#58; undefined reference to `glTranslatef'
main.c&#58;&#40;.text+0x2ec&#41;&#58; undefined reference to `glBegin'
main.c&#58;&#40;.text+0x304&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x31c&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x32c&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x334&#41;&#58; undefined reference to `glEnd'
main.c&#58;&#40;.text+0x348&#41;&#58; undefined reference to `glTranslatef'
main.c&#58;&#40;.text+0x350&#41;&#58; undefined reference to `glBegin'
main.c&#58;&#40;.text+0x360&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x370&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x380&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x390&#41;&#58; undefined reference to `glVertex3f'
main.c&#58;&#40;.text+0x398&#41;&#58; undefined reference to `glEnd'
main.c&#58;&#40;.text+0x3ac&#41;&#58; undefined reference to `glutSwapBuffers'
main.o&#58; In function `main'&#58;
main.c&#58;&#40;.text+0x3d8&#41;&#58; undefined reference to `glutInit'
main.c&#58;&#40;.text+0x3e0&#41;&#58; undefined reference to `glutInitDisplayMode'
main.c&#58;&#40;.text+0x3ec&#41;&#58; undefined reference to `glutInitWindowSize'
main.c&#58;&#40;.text+0x3f8&#41;&#58; undefined reference to `glutInitWindowPosition'
main.c&#58;&#40;.text+0x40c&#41;&#58; undefined reference to `glutCreateWindow'
main.c&#58;&#40;.text+0x41c&#41;&#58; undefined reference to `glutDisplayFunc'
main.c&#58;&#40;.text+0x424&#41;&#58; undefined reference to `glutFullScreen'
main.c&#58;&#40;.text+0x42c&#41;&#58; undefined reference to `glutIdleFunc'
main.c&#58;&#40;.text+0x438&#41;&#58; undefined reference to `glutReshapeFunc'
main.c&#58;&#40;.text+0x44c&#41;&#58; undefined reference to `glutMainLoop'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;pspgl.elf&#93; Error 1
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

You're not using the right libs in your Makefile - there is no 'libpspgl.a' libs. Use the following instead:

LIBS = -lGL -lGLU -lglut -lz -lm
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

I also noticed something else wrong with my make... thanks

... for some reason, after fixing that, it tried looking for pspgl dir in the wrong place, so i re-svn'd it and now im re- makeing... it seems stalled, but we'll see
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

New Error...

Code: Select all

linux&#58;/home/jesusxp/development/psp/projects/gl_ex # make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lpspgu -lGL -lGLU -lglut -lz -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o gl_ex.elf
main.o&#58; In function `main'&#58;
main.c&#58;&#40;.text+0x424&#41;&#58; undefined reference to `glutFullScreen'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;glLoadIdentity.o&#41;&#58; In function `glLoadIdentity'&#58;
/home/jesusxp/pspgl/glLoadIdentity.c&#58;23&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;glTranslatef.o&#41;&#58; In function `glTranslatef'&#58;
/home/jesusxp/pspgl/glTranslatef.c&#58;19&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;pspgl_context.o&#41;&#58; In function `flush_matrix'&#58;
/home/jesusxp/pspgl/pspgl_context.c&#58;108&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;pspgl_dlist.o&#41;&#58; In function `now'&#58;
/home/jesusxp/pspgl/pspgl_internal.h&#58;300&#58; undefined reference to `sceRtcGetCurrentTick'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;pspgl_matrix.o&#41;&#58; In function `__pspgl_matrix_sync'&#58;
/home/jesusxp/pspgl/pspgl_matrix.c&#58;19&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;pspgl_matrix.o&#41;&#58; In function `__pspgl_matrix_load'&#58;
/home/jesusxp/pspgl/pspgl_matrix.c&#58;33&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a&#40;pspgl_vidmem.o&#41;&#58; In function `now'&#58;
/home/jesusxp/pspgl/pspgl_internal.h&#58;300&#58; undefined reference to `sceRtcGetCurrentTick'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGLU.a&#40;gluPerspectivef.o&#41;&#58; In function `gluPerspectivef'&#58;
/home/jesusxp/pspgl/gluPerspectivef.c&#58;30&#58; undefined reference to `glMultMatrixf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libglut.a&#40;glut.o&#41;&#58; In function `cleanup'&#58;
/home/jesusxp/pspgl/glut.c&#58;99&#58; undefined reference to `eglTerminate'
/home/jesusxp/pspgl/glut.c&#58;99&#58; undefined reference to `eglGetError'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libglut.a&#40;glut.o&#41;&#58; In function `glutCreateWindow'&#58;
/home/jesusxp/pspgl/glut.c&#58;111&#58; undefined reference to `eglGetDisplay'
/home/jesusxp/pspgl/glut.c&#58;111&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;112&#58; undefined reference to `eglInitialize'
/home/jesusxp/pspgl/glut.c&#58;112&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;125&#58; undefined reference to `eglChooseConfig'
/home/jesusxp/pspgl/glut.c&#58;125&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;135&#58; undefined reference to `eglGetConfigAttrib'
/home/jesusxp/pspgl/glut.c&#58;135&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;136&#58; undefined reference to `eglGetConfigAttrib'
/home/jesusxp/pspgl/glut.c&#58;136&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;138&#58; undefined reference to `eglCreateContext'
/home/jesusxp/pspgl/glut.c&#58;138&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;139&#58; undefined reference to `eglCreateWindowSurface'
/home/jesusxp/pspgl/glut.c&#58;139&#58; undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c&#58;140&#58; undefined reference to `eglMakeCurrent'
/home/jesusxp/pspgl/glut.c&#58;140&#58; undefined reference to `eglGetError'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libglut.a&#40;glut.o&#41;&#58; In function `glutSwapBuffers'&#58;
/home/jesusxp/pspgl/glut.c&#58;263&#58; undefined reference to `eglSwapBuffers'
/home/jesusxp/pspgl/glut.c&#58;263&#58; undefined reference to `eglGetError'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;gl_ex.elf&#93; Error 1
linux&#58;/home/jesusxp/development/psp/projects/gl_ex #
for some reason its searching /home/jesusxp/pspgl/glut.c, ?! I thought I could run make, make install, and I would be able to remove this dir. Can anyone please help me to set it up properly?!

Where would my PSP_MOUNTDIR=<your_PSP_mountpoint> and PSP_REVISION=<your_PSP_revision> be?
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

Were you able to build and run the pspgl/tests/* programs? I've been using the pspgl lib now for a couple of weeks and I'm actually really impressed by them. I generally had no problem with them - assuming you've read the info about the limitations at http://www.goop.org/psp/gl/.

I don't use glut - I just call the egl routines directly to setup the gl context that I need. But by looking in the pspgl/glut.c, `glutFullScreen' isn't implemented, so you can't use that. Also, not all the variations of the gl*[sifd] functions are implemented, which explains a few of your other undefined references.

You're also missing the libs '-lpsprtc -lpspvfpu'. I can't explain the egl* undefined references - but it looks like some error with the pspgl install.
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

do you know where I can find those two missing libs?!! I reinstalled the toolchain and sdk, and tried looking at svn://svn.ps2dev.org and found nothing as well..
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

Im having trouble getting the tests to create anything! I ran make and it seemed to be successfull, yet nothing was built... if you have tips on how i can make sure my stuff is set up properly, thanks.

Edit:

I still cant seem to be getting any PSPGL stuff to compile... If anyone knows how to set it up properly, maybe we could have a conversation about it in pm, or on #pspdev
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

I keep getting undefined references, and for some reason, it searches for the wrong dir, /jesusxp/pspgl/?!?!
Any help!? I made like I would any other svn


Check out the errors again...
/home/jesusxp/pspgl/pspgl_internal.h:300: undefined reference to `sceRtcGetCurrentTick'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGLU.a(gluPerspectivef.o): In function `gluPerspectivef':
/home/jesusxp/pspgl/gluPerspectivef.c:30: undefined reference to `glMultMatrixf'
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

All I had to do was go into the pspgl/ dir and type 'make install'. The installation of pspgl does depend upon your psp-config settings - so, what is displayed when you type "psp-config --psp-prefix"?
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

when I compile now, im still getting some undefined references, is there anything else I need to remember when I "make" with the pspgl? the Readme has something
$ export PSP_MOUNTDIR=/Volumes/PSP
$ export PSP_REVISION=1.50
$ make && make -C tests clean install
$ make && make -C test-glut clean install

I know that was 1.50 PSP on MacOS-X instructions, but Im using Linux. I figure I just need to go back to the drawing board on the code, but I just wanna make sure I will be successfull...

(I went to the tests dir, in pspgl, and couldnt get any of it to compile,... I guess I need some help getting steared in the right direction -- btw ginka, I appreciate all your help thus far. Thank you very much!)
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

I started playing with PSPGL recently, and had to completely reinstall PSPSDK. I think you need to start completely from scratch, as GCC needs to be built to include the new vfpu functionality.

I've had no problems since!
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

I'm trying to help but you also have to help by supplying the info I'm asking for. As I said before, it really looks like you're pspgl installation didn't work and before you can compile any pspgl programs ( including the ones in tests ), you have to get the pspgl install working. So, what is printed when you type:

psp-config --psp-prefix

??

I'm running linux, and all I had to do was:

$ export PSP_MOUNTDIR=/mnt/psp
$ export PSP_REVISION=1.50
$ make install
$ cd tests
# make install

The other posibility is that you didn't have perms to install pspgl
into the $PSPDEV directories. What is printed out when you do the
first "make install" above?
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

You can compile your code with this:

Code: Select all

LIBS = -lGLU -lglut -lm -lGL -lpspvfpu -lpsprtc

Code: Select all

/* Go fullscreen.  This is as soon as possible. */
// glutFullScreen&#40;&#41;;
But nothing seems to appears on the PSP when launching the eboot.
(But I'm very new at C and don't know anything for now at openGL)
Good luck.
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

I addded that gluFullScreen line right in main, after I call pspDebugScreenInit();

heres my errors now:

Code: Select all

linux&#58;/home/jesusxp/development/psp/projects/gl_ex # make kxploit
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o main.c
main.c&#58; In function ‘main’&#58;
main.c&#58;129&#58; warning&#58; passing argument 1 of ‘glutDisplayFunc’ from incompatible pointer type
main.c&#58;135&#58; warning&#58; passing argument 1 of ‘glutIdleFunc’ from incompatible pointer type
main.c&#58; In function ‘InitGL’&#58;
main.c&#58;79&#58; warning&#58; control reaches end of non-void function
main.c&#58; In function ‘DrawGLScene’&#58;
main.c&#58;103&#58; warning&#58; control reaches end of non-void function
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lGLU -lglut -lm -lGL -lpspvfpu -lpsprtc -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o gl_ex.elf
main.o&#58; In function `main'&#58;
main.c&#58;&#40;.text+0x3c4&#41;&#58; undefined reference to `glutFullScreen'
main.c&#58;&#40;.text+0x424&#41;&#58; undefined reference to `glutFullScreen'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;gl_ex.elf&#93; Error 1
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

JesusXP wrote:I addded that gluFullScreen line right in main
Do you actually bother reading my replies? As I said three days ago:
ginka wrote:`glutFullScreen' isn't implemented, so you can't use that.
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

ohh sorry, than you replied with it commmented it out and I thought that was somewhere in my code, and I needed to add it in. My apalogies.

Now however a blank black screen is all that is drawn. It compiles, as shown:

Code: Select all

linux&#58;/home/jesusxp/development/psp/projects/gl_ex # make kxploit
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o main.c
main.c&#58; In function ‘main’&#58;
main.c&#58;129&#58; warning&#58; passing argument 1 of ‘glutDisplayFunc’ from incompatible pointer type
main.c&#58;135&#58; warning&#58; passing argument 1 of ‘glutIdleFunc’ from incompatible pointer type
main.c&#58; In function ‘InitGL’&#58;
main.c&#58;79&#58; warning&#58; control reaches end of non-void function
main.c&#58; In function ‘DrawGLScene’&#58;
main.c&#58;103&#58; warning&#58; control reaches end of non-void function
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lGLU -lglut -lm -lGL -lpspvfpu -lpsprtc -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o gl_ex.elf
psp-fixup-imports gl_ex.elf
mksfo 'Image Example' PARAM.SFO
mkdir -p "gl_ex"
psp-strip gl_ex.elf -o gl_ex/EBOOT.PBP
mkdir -p "gl_ex%"
pack-pbp "gl_ex%/EBOOT.PBP" PARAM.SFO NULL  \
        NULL NULL NULL  \
        NULL NULL NULL
linux&#58;/home/jesusxp/development/psp/projects/gl_ex #
Im going to try and figure out why its doing this now... I guess its the two passing arguements. I dont know why though, Is DrawGL Scene not valid to pass?! or is am I missing something?

Thanks again for your response.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Prototype from glut.h:
GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));

Your definition:
int DrawGLScene(GLvoid)

They are not compatible. You need
void GLUTCALLBACK DrawGLScene(void)

Same with the other one. FYI GLUTCALLBACK is defined as __cdecl.

Jim
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

which of NeHe's tutorials should I read? Im getting compile but blank screen..
jsgf
Posts: 254
Joined: Tue Jul 12, 2005 11:02 am
Contact:

Post by jsgf »

Did you get the pspgl tests working?

Its very easy to do something simple wrong and end up with a blank screen. In general I find its easiest to debug things on a desktop machine and then get it going on the PSP once you know the code is basically OK.

Otherwise, you can start with a known working program and make incremental changes to it until it does what you want.

Some specific suggestions:

I notice you're using GL_VIEW_PSP; I wouldn't do that. It's non-standard, and you should probably just leave it alone. use GL_MODELVIEW instead.

Your draw routine is just drawing a couple of flat shapes; I'd use glOrtho() to set up an orthographic projection rather than using perspective; it's too easy to end up looking in the wrong direction.

GL_QUADS isn't really supported, though it will work in this case.

Disable depth testing for now.
popcornx
Posts: 6
Joined: Tue Mar 14, 2006 7:56 am

Post by popcornx »

$ make install
psp-gcc -std=gnu99 -g -Wall -Wmissing-prototypes -Os -G0 -fsingle-precision-cons
tant -I. -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/sdk/include -
funit-at-a-time -MD -MF .deps/eglBindTexImage.d -c eglBindTexImage.c
In file included from eglBindTexImage.c:1:
pspgl_internal.h:9:21: error: pspvfpu.h: No such file or directory
In file included from eglBindTexImage.c:1:
pspgl_internal.h:50: error: requested alignment is not a constant
pspgl_internal.h:56: error: requested alignment is not a constant
pspgl_internal.h:57: error: requested alignment is not a constant
make: *** [eglBindTexImage.o] Error 1

this is the error I'm getting...

thanks in advance
JesusXP
Posts: 79
Joined: Tue Jan 17, 2006 11:16 am
Location: Ontario, Canada

Post by JesusXP »

I have successfully compiled NeHe's Lesson 3 OpenGL Tutorial, for the PSP.

Im sorta documenting this process at my own pace, but I figured since I just finally got it compiled and working, I can move more into this.

I've done it successfully in cygwin, and native linux.
dark_zarkon
Posts: 26
Joined: Wed Jan 11, 2006 9:35 pm

Post by dark_zarkon »

JesusXP wrote:I have successfully compiled NeHe's Lesson 3 OpenGL Tutorial, for the PSP.

Im sorta documenting this process at my own pace, but I figured since I just finally got it compiled and working, I can move more into this.

I've done it successfully in cygwin, and native linux.
Hi! :)

how do you have resolved the problem of "undefined reference"?

i have tested every sample but the result is this:

Code: Select all

> "make" 
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -g -Wall -O2 -MD -I/usr/local/pspdev/psp/sdk/include -I..  -L. -L/usr/local/pspdev/psp/sdk/lib   simple.o -lglut -lGLU -lGL -lm -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpsplibc -lpspuser -lpspkernel -lpsprtc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o depthtest.elf
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;eglCreateContext.o&#41;&#58; In function `eglCreateContext'&#58;
/home/franco/pspgl/eglCreateContext.c&#58;43&#58; undefined reference to `pspvfpu_initcontext'
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;eglDestroyContext.o&#41;&#58; In function `eglDestroyContext'&#58;
/home/franco/pspgl/eglDestroyContext.c&#58;42&#58; undefined reference to `pspvfpu_deletecontext'
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;glLoadIdentity.o&#41;&#58; In function `glLoadIdentity'&#58;
/home/franco/pspgl/glLoadIdentity.c&#58;23&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;pspgl_context.o&#41;&#58; In function `flush_matrix'&#58;
/home/franco/pspgl/pspgl_context.c&#58;108&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;pspgl_matrix.o&#41;&#58; In function `__pspgl_matrix_sync'&#58;
/home/franco/pspgl/pspgl_matrix.c&#58;19&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;pspgl_matrix.o&#41;&#58; In function `__pspgl_matrix_load'&#58;
/home/franco/pspgl/pspgl_matrix.c&#58;33&#58; undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a&#40;glMultMatrixf.o&#41;&#58; In function `glMultMatrixf'&#58;
/home/franco/pspgl/glMultMatrixf.c&#58;17&#58; undefined reference to `pspvfpu_use_matrices'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;depthtest.elf&#93; Error 1

> Process Exit Code&#58; 2
> Time Taken&#58; 00&#58;02
i use devkit pro with pspsdk other lib (i have installed also pspgl obviously...).

how can i resove this problem?

thanks! ;)
i'm italian...
forgive me for my english! :)
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

I had the same problem a while ago, which went away when I did a complete update of the toolchain (not just the SDK).

Not sure about devkit pro though.
dark_zarkon
Posts: 26
Joined: Wed Jan 11, 2006 9:35 pm

Post by dark_zarkon »

urchin wrote:I had the same problem a while ago, which went away when I did a complete update of the toolchain (not just the SDK).

Not sure about devkit pro though.
noob question here:

how can update my toolchain?
i'm italian...
forgive me for my english! :)
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

dark_zarkon wrote: noob question here:

how can update my toolchain?
Search is your friend. ;)

http://forums.ps2dev.org/viewtopic.php? ... sc&start=0
dark_zarkon
Posts: 26
Joined: Wed Jan 11, 2006 9:35 pm

Post by dark_zarkon »

Arwin wrote:
dark_zarkon wrote: noob question here:

how can update my toolchain?
Search is your friend. ;)

http://forums.ps2dev.org/viewtopic.php? ... sc&start=0
thanks!
i have update my toolchain and reinstalled pspgl but it doesn't work...

this is the makefile:

Code: Select all

ARCH = psp-
CC = $&#40;ARCH&#41;gcc
AS = $&#40;ARCH&#41;as
STRIP = $&#40;ARCH&#41;strip
SIZE = $&#40;ARCH&#41;size
MKSFO = mksfo
PACK_PBP = pack-pbp
FIXUP_IMPORTS = psp-fixup-imports
RM = rm -f

PSPPATH &#58;= $&#40;shell psp-config --pspsdk-path&#41;
PSPGL_LFLAGS = -lglut -lGLU -lGL -lm -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpsplibc -lpspuser -lpspkernel -lpsprtc
CFLAGS = -g -Wall -O2 -MD -I.. -I$&#40;PSPPATH&#41;/include
LFLAGS = -g -Wall -O2 -DMODULE_NAME="$&#40;TARGET&#41;" psp-setup.c -L.. -L$&#40;PSPPATH&#41;/lib $&#40;PSPGL_LFLAGS&#41;

TARGET = bezier
OBJS = simple.o 

EXTRA_TARGETS = EBOOT.PBP
BUILDDATE = $&#40;shell date "+%Y/%m/%d %k&#58;%M&#58;%S"&#41;
PSP_EBOOT_TITLE = $&#40;TARGET&#41; $&#40;BUILDDATE&#41;
PSP_EBOOT_ICON = NULL
PSP_EBOOT_ICON1 = NULL
PSP_EBOOT_UNKPNG = NULL
PSP_EBOOT_PIC1 = NULL
PSP_EBOOT_SND0 = NULL
PSP_EBOOT_PSAR = NULL

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;


all&#58; EBOOT.PBP


%.o&#58; %.raw
	&#40;sym=`echo $* | tr '-' '_'`; \
	 echo -e ".data\n.global $$&#123;sym&#125;_start\n$$&#123;sym&#125;_start&#58;\n\t.incbin "$<"" | $&#40;AS&#41; -o $@&#41;

%.raw&#58; %.png
	convert -geometry 64x64 $< rgba&#58;$@

.c.o&#58;
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c $<

$&#40;TARGET&#41;.elf&#58; $&#40;OBJS&#41; ../libGL.a ../libglut.a
	$&#40;CC&#41; $&#40;OBJS&#41; $&#40;LFLAGS&#41; -o $@

EBOOT.PBP&#58; $&#40;TARGET&#41;.elf
	$&#40;FIXUP_IMPORTS&#41; $&#40;TARGET&#41;.elf
	$&#40;MKSFO&#41; '$&#40;PSP_EBOOT_TITLE&#41;' $&#40;TARGET&#41;.sfo
	$&#40;STRIP&#41; $&#40;TARGET&#41;.elf -o $&#40;TARGET&#41;_strip.elf
	@echo -------------------------------------------------------------------------------------
	$&#40;SIZE&#41; $&#40;TARGET&#41;_strip.elf
	@echo -------------------------------------------------------------------------------------
	$&#40;PACK_PBP&#41; EBOOT.PBP $&#40;TARGET&#41;.sfo $&#40;PSP_EBOOT_ICON&#41;  \
		$&#40;PSP_EBOOT_ICON1&#41; $&#40;PSP_EBOOT_UNKPNG&#41; $&#40;PSP_EBOOT_PIC1&#41;  \
		$&#40;PSP_EBOOT_SND0&#41;  $&#40;TARGET&#41;_strip.elf $&#40;PSP_EBOOT_PSAR&#41;

install&#58; all $&#40;shell uname&#41;-install

Darwin-install&#58;
	@test -d "/Volumes/PSP STICK/" || \
		echo =========== PSP not connected, not installing =======================================
	@test -d "/Volumes/PSP STICK/"
	@echo ============= image done, now install on PSP ========================================
	rm -f "/Volumes/PSP STICK/log.txt"
	rm -f "/Volumes/PSP STICK/pspgl.ge"
	rm -rf "/Volumes/PSP STICK/PSP/GAME/$&#40;TARGET&#41;"
	mkdir "/Volumes/PSP STICK/PSP/GAME/$&#40;TARGET&#41;"
	cp -v EBOOT.PBP "/Volumes/PSP STICK/PSP/GAME/$&#40;TARGET&#41;/"
	sync

MOUNT=/mnt/stick
DIR=$&#40;MOUNT&#41;/psp/game

Linux-install&#58; EBOOT.PBP
	while &#91; ! -d $&#40;DIR&#41; &#93;; do mount $&#40;MOUNT&#41;; sleep 1; done
	mkdir -p $&#40;DIR&#41;/$&#40;TARGET&#41;
	mkdir -p $&#40;DIR&#41;/$&#40;TARGET&#41;%
	cp $&#40;TARGET&#41;_strip.elf $&#40;DIR&#41;/$&#40;TARGET&#41;/EBOOT.PBP
	cp EBOOT.PBP $&#40;DIR&#41;/$&#40;TARGET&#41;%/
	umount $&#40;MOUNT&#41;

clean&#58;
	$&#40;RM&#41; *.d *.o *.a *.elf *.sfo EBOOT.PBP

-include $&#40;wildcard *.d&#41; dummy

and this is the error:

Code: Select all

> "make" 
make&#58; *** No rule to make target `../libGL.a', needed by `bezier.elf'.  Stop.

> Process Exit Code&#58; 2
> Time Taken&#58; 00&#58;01
what can i do? :(
i'm italian...
forgive me for my english! :)
Post Reply