PSPGL errors?

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

Moderators: cheriff, TyRaNiD

Post Reply
psiko_scweek
Posts: 42
Joined: Sat Nov 12, 2005 2:30 am

PSPGL errors?

Post by psiko_scweek »

Alright just for fun, im trying to port an application to the PSP and im getting the following errors:

undefined reference to 'gluOrtho2D'
undefined reference to 'glVertex2s'
undefined reference to 'gluGetString'

as well as others.

Now I know they are all coming from PSPGL, does PSPGL support those functions and if so, what should the first location I should go to, to help solve those issues?
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

PSPGL is incomplete in some areas, particularly things that are un-needed.

gluOrtho2D is replaceable with glOrtho (with modifications)
glVertex2s should be able to be replaced with glVertex2f.
gluGetString is a tougher one, will depend what it is being used for.

What are you porting?
.::Albandu51::.
Posts: 12
Joined: Thu Oct 04, 2007 12:33 am

Post by .::Albandu51::. »

hello
Sorry for my language,i am French ^^

I have a problem me too !


see my screen:
Image

After modify with gluOrtho2D see :
Image

This is my code:

Code: Select all

#include <GL/glut.h>    // Header File For The GLUT Library
#include <GL/gl.h>   // Header File For The OpenGL32 Library
#include <GL/glu.h>   // Header File For The GLu32 Library
//#include <unistd.h>     // Header file for sleeping. @@@
#include <stdio.h>      // Header file for standard file i/o.
#include <stdlib.h>     // Header file for malloc/free.
#include <math.h>       // Header file for trigonometric functions.
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <pspuser.h>
#include <pspctrl.h>
//#include <unistd.h>     // Header file for sleeping. @@@

#define LARGEUR_BASE 50
#define HAUTEUR_BASE 20

#define LARGEUR_BRAS_1 150
#define HAUTEUR_BRAS_1 15

#define LARGEUR_BRAS_2 50
#define HAUTEUR_BRAS_2 10

#define TAILLE_CAISSE 10

#define LARGEUR_ECRAN 480
#define HAUTEUR_ECRAN 272

int angle1 = 45;
int angle2 = -20;
int longueur = 50;



PSP_MODULE_INFO&#40;"Alban", 0x0, 1, 1&#41;;

PSP_MAIN_THREAD_ATTR&#40;0&#41;;

void Dessiner&#40;&#41;;

int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;

    SDL_Init&#40;SDL_INIT_VIDEO&#41;;
    atexit&#40;SDL_Quit&#41;;

    SDL_SetVideoMode&#40;LARGEUR_ECRAN, HAUTEUR_ECRAN, 32, SDL_OPENGL&#41;;

    glMatrixMode&#40; GL_PROJECTION &#41;;
    glLoadIdentity&#40; &#41;;
    gluOrtho2D&#40;0,LARGEUR_ECRAN,0,HAUTEUR_ECRAN&#41;;

int continuer = 1;

    Dessiner&#40;&#41;;
   
    int angle;
           
    SceCtrlData pad;

    while&#40;continuer&#41;
    &#123;
   sceCtrlReadBufferPositive&#40;&pad, 1&#41;;

  switch &#40;pad.Buttons&#41;
    &#123;                                                                   
           case PSP_CTRL_UP &#58;
               longueur --;
                if &#40;longueur < 10&#41;
                    longueur = 10;
                break;
                case PSP_CTRL_DOWN&#58;
                longueur ++;
                if &#40;longueur > 100&#41;
                    longueur = 100;
                break;
                case PSP_CTRL_LEFT&#58;
                if &#40;angle==1&#41;
                &#123;
                    angle1++;
                    if &#40;angle1 > 90&#41;
                        angle1 = 90;
                &#125;
                else
                &#123;
                    angle2++;
                &#125;
                break;
                 case PSP_CTRL_RIGHT&#58;
                if &#40;angle==1&#41;
                &#123;
                    angle1--;
                    if &#40;angle1 < 10&#41;
                        angle1 = 10;
                &#125;
                else
                &#123;
                    angle2--;
                    if &#40;angle2 < -90&#41;
                        angle2 = -90;
                &#125;
                break;
                case PSP_CTRL_RTRIGGER&#58;
                angle = 1;
                break;
                            &#125;
        Dessiner&#40;&#41;;
    &#125;



    return 0;
&#125;

/*
    Dessine un rectangle avec comme point de reférence
    le milieu du coté gauche
*/
void dessineRectangle&#40;double largeur,double hauteur&#41;
&#123;
    glBegin&#40;GL_QUADS&#41;;
    glVertex2d&#40;0,-hauteur/2&#41;;
    glVertex2d&#40;0,hauteur/2&#41;;
    glVertex2d&#40;largeur,hauteur/2&#41;;
    glVertex2d&#40;largeur,-hauteur/2&#41;;
    glEnd&#40;&#41;;
&#125;

/*
    Dessine le repère actuel pour faciliter
    la compréhension des transformations.
    Utiliser "echelle" pour avoir un repère bien orienté et positionné
    mais avec une échelle différente.
*/
void dessinerRepere&#40;unsigned int echelle = 1&#41;
&#123;
    glPushMatrix&#40;&#41;;
    glScaled&#40;echelle,echelle,echelle&#41;;
    glBegin&#40;GL_LINES&#41;;
    glColor3ub&#40;0,0,255&#41;;
    glVertex2i&#40;0,0&#41;;
    glVertex2i&#40;1,0&#41;;
    glColor3ub&#40;0,255,0&#41;;
    glVertex2i&#40;0,0&#41;;
    glVertex2i&#40;0,1&#41;;
    glEnd&#40;&#41;;
    glPopMatrix&#40;&#41;;
&#125;

void Dessiner&#40;&#41;
&#123;
    glClear&#40; GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT &#41;;

    glMatrixMode&#40; GL_MODELVIEW &#41;;
    glLoadIdentity&#40; &#41;;

    /* Je déplace mon répère initial &#40;actuellement
    en bas à gauche de l'écran&#41; */
    glTranslatef&#40;LARGEUR_BASE/2,HAUTEUR_BASE,0&#41;;

    // La base
    glColor3ub&#40;254,128,1&#41;;
    dessineRectangle&#40;LARGEUR_BASE,HAUTEUR_BASE&#41;;

    //Je me place en haut au milieu de la base
    glTranslatef&#40;LARGEUR_BASE/2,HAUTEUR_BASE/2,0&#41;;

    // Le grand bras
    glRotatef&#40;angle1,0,0,1&#41;;
    glColor3ub&#40;248,230,7&#41;;
    dessineRectangle&#40;LARGEUR_BRAS_1,HAUTEUR_BRAS_1&#41;;

    // Je me place au bout du grand bras
    glTranslatef&#40;LARGEUR_BRAS_1,0,0&#41;;

    // Puis m'occupe du petit bras
    glRotatef&#40;angle2,0,0,1&#41;;
    glColor3ub&#40;186,234,21&#41;;
    dessineRectangle&#40;LARGEUR_BRAS_2,HAUTEUR_BRAS_2&#41;;

    // Je me place au bout du petit bras
    glTranslatef&#40;LARGEUR_BRAS_2,0,0&#41;;
    /* J'annule les rotations pour avoir mon repère aligné
    avec le repère d'origine */
    glRotatef&#40;-angle1-angle2,0,0,1&#41;;

    // Je dessine le fil
    glColor3ub&#40;255,255,255&#41;;
    glBegin&#40;GL_LINES&#41;;
    glVertex2i&#40;0,0&#41;;
    glVertex2i&#40;0,-longueur&#41;;
    glEnd&#40;&#41;;

    /* Je descends en bas du fil &#40;avec un petit décalage
    sur X pour anticiper le dessin de la caisse */
    glTranslatef&#40;-TAILLE_CAISSE/2,-longueur,0&#41;;

    // Et je dessine enfin la caisse
    glColor3ub&#40;175,175,85&#41;;
    dessineRectangle&#40;TAILLE_CAISSE,TAILLE_CAISSE&#41;;

    glFlush&#40;&#41;;
    SDL_GL_SwapBuffers&#40;&#41;;
&#125;
quadrizo
Posts: 21
Joined: Thu Aug 23, 2007 10:21 pm

Post by quadrizo »

it's glOrtho and not glOrtho2d
and need to link with -lpspvfpu i think
.::Albandu51::.
Posts: 12
Joined: Thu Oct 04, 2007 12:33 am

Post by .::Albandu51::. »

Ok thank's
But i put

Code: Select all

glOrtho&#40;0,LARGEUR_ECRAN,0,HAUTEUR_ECRAN&#41;;
And == no compile xD
see:
Image

After i put

Code: Select all

glOrtho&#40;0,LARGEUR_ECRAN,0,HAUTEUR_ECRAN,0,0&#41;;
and == no compile
see:
Image

Help me please ^^
Thanks you
(Sorry for my language, i am french and i have 14 years old ) i write a little english
quadrizo
Posts: 21
Joined: Thu Aug 23, 2007 10:21 pm

Post by quadrizo »

french:
pour que ce soit clair
l'erreur ne vient pas de ton code mais du linkage c'est a dire qu'il te dit qu'il ne trouve pas dans les librairies la fonction "sceRtc.." donc il faut que tu ajoutes la bonne librairies surement "-lpsprtc"



the error is not in the code but in the linkage ...
you need to add the rtc lib : -lpsprtc
.::Albandu51::.
Posts: 12
Joined: Thu Oct 04, 2007 12:33 am

Post by .::Albandu51::. »

Thank's you !
The code compile ^^ but not fonction on psp ( screen black + freeze ) xD
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

.::Albandu51::. wrote:Thank's you !
The code compile ^^ but not fonction on psp ( screen black + freeze ) xD
Your code isn't set to use the vfpu. You need

Code: Select all

PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_VFPU | PSP_THREAD_ATTR_USER&#41;;
psiko_scweek
Posts: 42
Joined: Sat Nov 12, 2005 2:30 am

ok....

Post by psiko_scweek »

Alright, thanks for the advice so far. I have either just removed the trouble code or converted it to what works. Just a few questions:

I am still getting errors with the following OpenGL commands.

glPixelMapfv
gluOrtho2D
glPixelTransferi

alright any suggestions about those? I know you said that gluOrtho2D can be subbed for gluOrtho with some modifying and I did see some samples on how to try that. Are the other two commands supported by PSPGL?

Thanks!
Post Reply