forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help compiling with PSPGL

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Sat Mar 11, 2006 11:58 am    Post subject: Help compiling with PSPGL Reply with quote

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:

/* 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("PSPGL Example",0,1,1);

#define printf pspDebugScreenPrintf

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common){
   sceKernelExitGame();
   return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp){
   int cbid;
   
   cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
   sceKernelRegisterExitCallback(cbid);
   
   sceKernelSleepThreadCB();
   
   return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void){
   int thid = 0;
   
   thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
   if(thid >= 0){
      sceKernelStartThread(thid, 0, 0);
   }
   
   return thid;
}

void ReSizeGLScene(GLsizei width, GLsizei height){
   if(height == 0){
      height=1;
   }
   glViewport(0, 0, width, height);//Reset the Current Viewport
   glMatrixMode(GL_PROJECTION);   //select the Projection Maxtrix
   glLoadIdentity();      //Reset the Projection Matrix
   
   // Calculate the Aspect Ratio of the Window
   gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
   glMatrixMode(GL_MODELVIEW);   //Select the Modelview Matrix
   //glLoadIdentity();      //Reset the Modelview Matrix
}

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

   gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);   // Calculate The Aspect Ratio Of The Window
   glMatrixMode(GL_VIEW_PSP);
//   return TRUE; //initialization went ok
}

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

int main(int argc, char **argv){
   
   pspDebugScreenInit();
   SetupCallbacks();
   glutInit(&argc, argv);
   
   /* Select type of Display mode:   
        Double buffer
        RGBA color
        Alpha components supported
        Depth buffer */ 
     glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH); 

     /* get a 640 x 480 window */
     glutInitWindowSize(480, 272); 

     /* the window starts at the upper left corner of the screen */
     glutInitWindowPosition(0, 0); 

     /* Open a window */ 
     window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99"); 

     /* Register the function to do all our OpenGL drawing. */
     glutDisplayFunc(&DrawGLScene); 

     /* Go fullscreen.  This is as soon as possible. */
     glutFullScreen();

     /* Even if there are no events, redraw our gl scene. */
     glutIdleFunc(&DrawGLScene);

     /* Register the function called when our window is resized. */
     glutReshapeFunc(&ReSizeGLScene);

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



Makefile
Code:

TARGET = pspgl
OBJS = main.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Image Example

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


Error
Code:

linux:/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: In function ‘main’:
main.c:128: warning: passing argument 1 of ‘glutDisplayFunc’ from incompatible pointer type
main.c:134: warning: passing argument 1 of ‘glutIdleFunc’ from incompatible pointer type
main.c: In function ‘InitGL’:
main.c:79: warning: control reaches end of non-void function
main.c: In function ‘DrawGLScene’:
main.c:103: warning: 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: unrecognized option '-pspgl'
main.o: In function `ReSizeGLScene':
main.c:(.text+0xf0): undefined reference to `glViewport'
main.c:(.text+0xf8): undefined reference to `glMatrixMode'
main.c:(.text+0x100): undefined reference to `glLoadIdentity'
main.c:(.text+0x144): undefined reference to `gluPerspective'
main.c:(.text+0x15c): undefined reference to `glMatrixMode'
main.c:(.text+0x178): undefined reference to `glViewport'
main.c:(.text+0x180): undefined reference to `glMatrixMode'
main.c:(.text+0x188): undefined reference to `glLoadIdentity'
main.c:(.text+0x1cc): undefined reference to `gluPerspective'
main.c:(.text+0x1e4): undefined reference to `glMatrixMode'
main.o: In function `InitGL':
main.c:(.text+0x208): undefined reference to `glShadeModel'
main.c:(.text+0x220): undefined reference to `glClearColor'
main.c:(.text+0x230): undefined reference to `glClearDepth'
main.c:(.text+0x238): undefined reference to `glEnable'
main.c:(.text+0x240): undefined reference to `glDepthFunc'
main.c:(.text+0x248): undefined reference to `glMatrixMode'
main.c:(.text+0x250): undefined reference to `glLoadIdentity'
main.c:(.text+0x290): undefined reference to `gluPerspective'
main.c:(.text+0x2ac): undefined reference to `glMatrixMode'
main.o: In function `DrawGLScene':
main.c:(.text+0x2c4): undefined reference to `glClear'
main.c:(.text+0x2cc): undefined reference to `glLoadIdentity'
main.c:(.text+0x2e4): undefined reference to `glTranslatef'
main.c:(.text+0x2ec): undefined reference to `glBegin'
main.c:(.text+0x304): undefined reference to `glVertex3f'
main.c:(.text+0x31c): undefined reference to `glVertex3f'
main.c:(.text+0x32c): undefined reference to `glVertex3f'
main.c:(.text+0x334): undefined reference to `glEnd'
main.c:(.text+0x348): undefined reference to `glTranslatef'
main.c:(.text+0x350): undefined reference to `glBegin'
main.c:(.text+0x360): undefined reference to `glVertex3f'
main.c:(.text+0x370): undefined reference to `glVertex3f'
main.c:(.text+0x380): undefined reference to `glVertex3f'
main.c:(.text+0x390): undefined reference to `glVertex3f'
main.c:(.text+0x398): undefined reference to `glEnd'
main.c:(.text+0x3ac): undefined reference to `glutSwapBuffers'
main.o: In function `main':
main.c:(.text+0x3d8): undefined reference to `glutInit'
main.c:(.text+0x3e0): undefined reference to `glutInitDisplayMode'
main.c:(.text+0x3ec): undefined reference to `glutInitWindowSize'
main.c:(.text+0x3f8): undefined reference to `glutInitWindowPosition'
main.c:(.text+0x40c): undefined reference to `glutCreateWindow'
main.c:(.text+0x41c): undefined reference to `glutDisplayFunc'
main.c:(.text+0x424): undefined reference to `glutFullScreen'
main.c:(.text+0x42c): undefined reference to `glutIdleFunc'
main.c:(.text+0x438): undefined reference to `glutReshapeFunc'
main.c:(.text+0x44c): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
make: *** [pspgl.elf] Error 1
Back to top
View user's profile Send private message MSN Messenger
ginka



Joined: 17 Feb 2006
Posts: 15

PostPosted: Sat Mar 11, 2006 12:19 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Sat Mar 11, 2006 12:30 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Sat Mar 11, 2006 12:46 pm    Post subject: Reply with quote

New Error...

Code:
linux:/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: In function `main':
main.c:(.text+0x424): undefined reference to `glutFullScreen'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(glLoadIdentity.o): In function `glLoadIdentity':
/home/jesusxp/pspgl/glLoadIdentity.c:23: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(glTranslatef.o): In function `glTranslatef':
/home/jesusxp/pspgl/glTranslatef.c:19: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(pspgl_context.o): In function `flush_matrix':
/home/jesusxp/pspgl/pspgl_context.c:108: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(pspgl_dlist.o): In function `now':
/home/jesusxp/pspgl/pspgl_internal.h:300: undefined reference to `sceRtcGetCurrentTick'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(pspgl_matrix.o): In function `__pspgl_matrix_sync':
/home/jesusxp/pspgl/pspgl_matrix.c:19: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(pspgl_matrix.o): In function `__pspgl_matrix_load':
/home/jesusxp/pspgl/pspgl_matrix.c:33: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libGL.a(pspgl_vidmem.o): In function `now':
/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'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libglut.a(glut.o): In function `cleanup':
/home/jesusxp/pspgl/glut.c:99: undefined reference to `eglTerminate'
/home/jesusxp/pspgl/glut.c:99: undefined reference to `eglGetError'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libglut.a(glut.o): In function `glutCreateWindow':
/home/jesusxp/pspgl/glut.c:111: undefined reference to `eglGetDisplay'
/home/jesusxp/pspgl/glut.c:111: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:112: undefined reference to `eglInitialize'
/home/jesusxp/pspgl/glut.c:112: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:125: undefined reference to `eglChooseConfig'
/home/jesusxp/pspgl/glut.c:125: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:135: undefined reference to `eglGetConfigAttrib'
/home/jesusxp/pspgl/glut.c:135: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:136: undefined reference to `eglGetConfigAttrib'
/home/jesusxp/pspgl/glut.c:136: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:138: undefined reference to `eglCreateContext'
/home/jesusxp/pspgl/glut.c:138: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:139: undefined reference to `eglCreateWindowSurface'
/home/jesusxp/pspgl/glut.c:139: undefined reference to `eglGetError'
/home/jesusxp/pspgl/glut.c:140: undefined reference to `eglMakeCurrent'
/home/jesusxp/pspgl/glut.c:140: undefined reference to `eglGetError'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libglut.a(glut.o): In function `glutSwapBuffers':
/home/jesusxp/pspgl/glut.c:263: undefined reference to `eglSwapBuffers'
/home/jesusxp/pspgl/glut.c:263: undefined reference to `eglGetError'
collect2: ld returned 1 exit status
make: *** [gl_ex.elf] Error 1
linux:/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?
Back to top
View user's profile Send private message MSN Messenger
ginka



Joined: 17 Feb 2006
Posts: 15

PostPosted: Sat Mar 11, 2006 1:31 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Sat Mar 11, 2006 2:11 pm    Post subject: Reply with quote

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..
Back to top
View user's profile Send private message MSN Messenger
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Sat Mar 11, 2006 3:34 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Mon Mar 13, 2006 8:56 am    Post subject: Reply with quote

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...

Quote:
/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'
Back to top
View user's profile Send private message MSN Messenger
ginka



Joined: 17 Feb 2006
Posts: 15

PostPosted: Mon Mar 13, 2006 11:55 am    Post subject: Reply with quote

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"?
Back to top
View user's profile Send private message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Mon Mar 13, 2006 7:11 pm    Post subject: Reply with quote

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!)
Back to top
View user's profile Send private message MSN Messenger
urchin



Joined: 02 Jun 2005
Posts: 121

PostPosted: Mon Mar 13, 2006 8:45 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
ginka



Joined: 17 Feb 2006
Posts: 15

PostPosted: Mon Mar 13, 2006 10:55 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Ats



Joined: 05 Dec 2005
Posts: 37
Location: Biarritz - France

PostPosted: Tue Mar 14, 2006 12:49 am    Post subject: Reply with quote

You can compile your code with this:
Code:
LIBS = -lGLU -lglut -lm -lGL -lpspvfpu -lpsprtc

Code:
/* Go fullscreen.  This is as soon as possible. */
// glutFullScreen();


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.
Back to top
View user's profile Send private message Visit poster's website
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Tue Mar 14, 2006 5:40 am    Post subject: Reply with quote

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

heres my errors now:

Code:
linux:/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: In function ‘main’:
main.c:129: warning: passing argument 1 of ‘glutDisplayFunc’ from incompatible pointer type
main.c:135: warning: passing argument 1 of ‘glutIdleFunc’ from incompatible pointer type
main.c: In function ‘InitGL’:
main.c:79: warning: control reaches end of non-void function
main.c: In function ‘DrawGLScene’:
main.c:103: warning: 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: In function `main':
main.c:(.text+0x3c4): undefined reference to `glutFullScreen'
main.c:(.text+0x424): undefined reference to `glutFullScreen'
collect2: ld returned 1 exit status
make: *** [gl_ex.elf] Error 1
Back to top
View user's profile Send private message MSN Messenger
ginka



Joined: 17 Feb 2006
Posts: 15

PostPosted: Tue Mar 14, 2006 7:07 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Tue Mar 14, 2006 4:59 pm    Post subject: Reply with quote

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:
linux:/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: In function ‘main’:
main.c:129: warning: passing argument 1 of ‘glutDisplayFunc’ from incompatible pointer type
main.c:135: warning: passing argument 1 of ‘glutIdleFunc’ from incompatible pointer type
main.c: In function ‘InitGL’:
main.c:79: warning: control reaches end of non-void function
main.c: In function ‘DrawGLScene’:
main.c:103: warning: 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:/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.
Back to top
View user's profile Send private message MSN Messenger
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Thu Mar 16, 2006 7:03 am    Post subject: Reply with quote

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
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Fri Mar 17, 2006 3:30 pm    Post subject: Reply with quote

which of NeHe's tutorials should I read? Im getting compile but blank screen..
Back to top
View user's profile Send private message MSN Messenger
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Fri Mar 17, 2006 5:26 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
popcornx



Joined: 14 Mar 2006
Posts: 6

PostPosted: Mon Mar 20, 2006 1:09 pm    Post subject: Reply with quote

$ 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
Back to top
View user's profile Send private message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Wed Mar 22, 2006 10:05 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message MSN Messenger
dark_zarkon



Joined: 11 Jan 2006
Posts: 26

PostPosted: Sun May 07, 2006 7:36 pm    Post subject: Reply with quote

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:
> "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(eglCreateContext.o): In function `eglCreateContext':
/home/franco/pspgl/eglCreateContext.c:43: undefined reference to `pspvfpu_initcontext'
/usr/local/pspdev/psp/sdk/lib/libGL.a(eglDestroyContext.o): In function `eglDestroyContext':
/home/franco/pspgl/eglDestroyContext.c:42: undefined reference to `pspvfpu_deletecontext'
/usr/local/pspdev/psp/sdk/lib/libGL.a(glLoadIdentity.o): In function `glLoadIdentity':
/home/franco/pspgl/glLoadIdentity.c:23: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a(pspgl_context.o): In function `flush_matrix':
/home/franco/pspgl/pspgl_context.c:108: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a(pspgl_matrix.o): In function `__pspgl_matrix_sync':
/home/franco/pspgl/pspgl_matrix.c:19: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a(pspgl_matrix.o): In function `__pspgl_matrix_load':
/home/franco/pspgl/pspgl_matrix.c:33: undefined reference to `pspvfpu_use_matrices'
/usr/local/pspdev/psp/sdk/lib/libGL.a(glMultMatrixf.o): In function `glMultMatrixf':
/home/franco/pspgl/glMultMatrixf.c:17: undefined reference to `pspvfpu_use_matrices'
collect2: ld returned 1 exit status
make: *** [depthtest.elf] Error 1

> Process Exit Code: 2
> Time Taken: 00: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! :)
Back to top
View user's profile Send private message
urchin



Joined: 02 Jun 2005
Posts: 121

PostPosted: Sun May 07, 2006 7:48 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
dark_zarkon



Joined: 11 Jan 2006
Posts: 26

PostPosted: Sun May 07, 2006 9:35 pm    Post subject: Reply with quote

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! :)
Back to top
View user's profile Send private message
Arwin



Joined: 12 Jul 2005
Posts: 426

PostPosted: Mon May 08, 2006 10:27 pm    Post subject: Reply with quote

dark_zarkon wrote:

noob question here:

how can update my toolchain?


Search is your friend. ;)

http://forums.ps2dev.org/viewtopic.php?t=2478&postdays=0&postorder=asc&start=0
Back to top
View user's profile Send private message
dark_zarkon



Joined: 11 Jan 2006
Posts: 26

PostPosted: Thu May 11, 2006 10:41 pm    Post subject: Reply with quote

Arwin wrote:
dark_zarkon wrote:

noob question here:

how can update my toolchain?


Search is your friend. ;)

http://forums.ps2dev.org/viewtopic.php?t=2478&postdays=0&postorder=asc&start=0


thanks!
i have update my toolchain and reinstalled pspgl but it doesn't work...

this is the makefile:

Code:
ARCH = psp-
CC = $(ARCH)gcc
AS = $(ARCH)as
STRIP = $(ARCH)strip
SIZE = $(ARCH)size
MKSFO = mksfo
PACK_PBP = pack-pbp
FIXUP_IMPORTS = psp-fixup-imports
RM = rm -f

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

TARGET = bezier
OBJS = simple.o

EXTRA_TARGETS = EBOOT.PBP
BUILDDATE = $(shell date "+%Y/%m/%d %k:%M:%S")
PSP_EBOOT_TITLE = $(TARGET) $(BUILDDATE)
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=$(shell psp-config --pspsdk-path)


all: EBOOT.PBP


%.o: %.raw
   (sym=`echo $* | tr '-' '_'`; \
    echo -e ".data\n.global $${sym}_start\n$${sym}_start:\n\t.incbin \"$<\"" | $(AS) -o $@)

%.raw: %.png
   convert -geometry 64x64 $< rgba:$@

.c.o:
   $(CC) $(CFLAGS) -c $<

$(TARGET).elf: $(OBJS) ../libGL.a ../libglut.a
   $(CC) $(OBJS) $(LFLAGS) -o $@

EBOOT.PBP: $(TARGET).elf
   $(FIXUP_IMPORTS) $(TARGET).elf
   $(MKSFO) '$(PSP_EBOOT_TITLE)' $(TARGET).sfo
   $(STRIP) $(TARGET).elf -o $(TARGET)_strip.elf
   @echo -------------------------------------------------------------------------------------
   $(SIZE) $(TARGET)_strip.elf
   @echo -------------------------------------------------------------------------------------
   $(PACK_PBP) EBOOT.PBP $(TARGET).sfo $(PSP_EBOOT_ICON)  \
      $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
      $(PSP_EBOOT_SND0)  $(TARGET)_strip.elf $(PSP_EBOOT_PSAR)

install: all $(shell uname)-install

Darwin-install:
   @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/$(TARGET)"
   mkdir "/Volumes/PSP STICK/PSP/GAME/$(TARGET)"
   cp -v EBOOT.PBP "/Volumes/PSP STICK/PSP/GAME/$(TARGET)/"
   sync

MOUNT=/mnt/stick
DIR=$(MOUNT)/psp/game

Linux-install: EBOOT.PBP
   while [ ! -d $(DIR) ]; do mount $(MOUNT); sleep 1; done
   mkdir -p $(DIR)/$(TARGET)
   mkdir -p $(DIR)/$(TARGET)%
   cp $(TARGET)_strip.elf $(DIR)/$(TARGET)/EBOOT.PBP
   cp EBOOT.PBP $(DIR)/$(TARGET)%/
   umount $(MOUNT)

clean:
   $(RM) *.d *.o *.a *.elf *.sfo EBOOT.PBP

-include $(wildcard *.d) dummy



and this is the error:

Code:
> "make"
make: *** No rule to make target `../libGL.a', needed by `bezier.elf'.  Stop.

> Process Exit Code: 2
> Time Taken: 00:01


what can i do? :(
_________________
i'm italian...
forgive me for my english! :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group