 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
psiko_scweek
Joined: 12 Nov 2005 Posts: 42
|
Posted: Wed Oct 03, 2007 2:19 pm Post subject: PSPGL errors? |
|
|
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? |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Wed Oct 03, 2007 6:23 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
.::Albandu51::.
Joined: 04 Oct 2007 Posts: 12
|
Posted: Thu Oct 04, 2007 12:39 am Post subject: |
|
|
hello
Sorry for my language,i am French ^^
I have a problem me too !
see my screen:
After modify with gluOrtho2D see :
This is my code:
| Code: | #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("Alban", 0x0, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
void Dessiner();
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO);
atexit(SDL_Quit);
SDL_SetVideoMode(LARGEUR_ECRAN, HAUTEUR_ECRAN, 32, SDL_OPENGL);
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
gluOrtho2D(0,LARGEUR_ECRAN,0,HAUTEUR_ECRAN);
int continuer = 1;
Dessiner();
int angle;
SceCtrlData pad;
while(continuer)
{
sceCtrlReadBufferPositive(&pad, 1);
switch (pad.Buttons)
{
case PSP_CTRL_UP :
longueur --;
if (longueur < 10)
longueur = 10;
break;
case PSP_CTRL_DOWN:
longueur ++;
if (longueur > 100)
longueur = 100;
break;
case PSP_CTRL_LEFT:
if (angle==1)
{
angle1++;
if (angle1 > 90)
angle1 = 90;
}
else
{
angle2++;
}
break;
case PSP_CTRL_RIGHT:
if (angle==1)
{
angle1--;
if (angle1 < 10)
angle1 = 10;
}
else
{
angle2--;
if (angle2 < -90)
angle2 = -90;
}
break;
case PSP_CTRL_RTRIGGER:
angle = 1;
break;
}
Dessiner();
}
return 0;
}
/*
Dessine un rectangle avec comme point de reférence
le milieu du coté gauche
*/
void dessineRectangle(double largeur,double hauteur)
{
glBegin(GL_QUADS);
glVertex2d(0,-hauteur/2);
glVertex2d(0,hauteur/2);
glVertex2d(largeur,hauteur/2);
glVertex2d(largeur,-hauteur/2);
glEnd();
}
/*
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(unsigned int echelle = 1)
{
glPushMatrix();
glScaled(echelle,echelle,echelle);
glBegin(GL_LINES);
glColor3ub(0,0,255);
glVertex2i(0,0);
glVertex2i(1,0);
glColor3ub(0,255,0);
glVertex2i(0,0);
glVertex2i(0,1);
glEnd();
glPopMatrix();
}
void Dessiner()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );
/* Je déplace mon répère initial (actuellement
en bas à gauche de l'écran) */
glTranslatef(LARGEUR_BASE/2,HAUTEUR_BASE,0);
// La base
glColor3ub(254,128,1);
dessineRectangle(LARGEUR_BASE,HAUTEUR_BASE);
//Je me place en haut au milieu de la base
glTranslatef(LARGEUR_BASE/2,HAUTEUR_BASE/2,0);
// Le grand bras
glRotatef(angle1,0,0,1);
glColor3ub(248,230,7);
dessineRectangle(LARGEUR_BRAS_1,HAUTEUR_BRAS_1);
// Je me place au bout du grand bras
glTranslatef(LARGEUR_BRAS_1,0,0);
// Puis m'occupe du petit bras
glRotatef(angle2,0,0,1);
glColor3ub(186,234,21);
dessineRectangle(LARGEUR_BRAS_2,HAUTEUR_BRAS_2);
// Je me place au bout du petit bras
glTranslatef(LARGEUR_BRAS_2,0,0);
/* J'annule les rotations pour avoir mon repère aligné
avec le repère d'origine */
glRotatef(-angle1-angle2,0,0,1);
// Je dessine le fil
glColor3ub(255,255,255);
glBegin(GL_LINES);
glVertex2i(0,0);
glVertex2i(0,-longueur);
glEnd();
/* Je descends en bas du fil (avec un petit décalage
sur X pour anticiper le dessin de la caisse */
glTranslatef(-TAILLE_CAISSE/2,-longueur,0);
// Et je dessine enfin la caisse
glColor3ub(175,175,85);
dessineRectangle(TAILLE_CAISSE,TAILLE_CAISSE);
glFlush();
SDL_GL_SwapBuffers();
} |
|
|
| Back to top |
|
 |
quadrizo
Joined: 23 Aug 2007 Posts: 21
|
Posted: Thu Oct 04, 2007 1:52 am Post subject: |
|
|
it's glOrtho and not glOrtho2d
and need to link with -lpspvfpu i think |
|
| Back to top |
|
 |
.::Albandu51::.
Joined: 04 Oct 2007 Posts: 12
|
Posted: Thu Oct 04, 2007 2:42 am Post subject: |
|
|
Ok thank's
But i put | Code: | | glOrtho(0,LARGEUR_ECRAN,0,HAUTEUR_ECRAN); |
And == no compile xD
see:
After i put
| Code: | | glOrtho(0,LARGEUR_ECRAN,0,HAUTEUR_ECRAN,0,0); |
and == no compile
see:
Help me please ^^
Thanks you
(Sorry for my language, i am french and i have 14 years old ) i write a little english |
|
| Back to top |
|
 |
quadrizo
Joined: 23 Aug 2007 Posts: 21
|
Posted: Thu Oct 04, 2007 2:48 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
.::Albandu51::.
Joined: 04 Oct 2007 Posts: 12
|
Posted: Thu Oct 04, 2007 2:54 am Post subject: |
|
|
Thank's you !
The code compile ^^ but not fonction on psp ( screen black + freeze ) xD |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Thu Oct 04, 2007 6:15 am Post subject: |
|
|
| .::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: | | PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VFPU | PSP_THREAD_ATTR_USER); |
|
|
| Back to top |
|
 |
psiko_scweek
Joined: 12 Nov 2005 Posts: 42
|
Posted: Thu Oct 04, 2007 11:25 am Post subject: ok.... |
|
|
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! |
|
| Back to top |
|
 |
|
|
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
|