Update PSPGL?
Update PSPGL?
Hi! Current version of PSPGL is very old,and it doesn't support lot of things from original OpenGL - but there is an updated version of pspgl,with(among other bugfixes) working fog. The problem is,that it won't compile under latest PSPSDK. It looks for gcc 4.0.2,and current version is 4.1.0. Could someone take a look at it and modify it to work on latest sdk? I don't have time,nor knowledge to do it. Thanks :D
http://edorul.free.fr/psp/pspgl_modified.rar
http://edorul.free.fr/psp/pspgl_modified.rar
My projects:
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
Re: Update PSPGL?
ok, using cygwin psp-gcc 4.1.0 (oopo's pspsdk), it says :gambiting wrote:Hi! Current version of PSPGL is very old,and it doesn't support lot of things from original OpenGL - but there is an updated version of pspgl,with(among other bugfixes) working fog. The problem is,that it won't compile under latest PSPSDK. It looks for gcc 4.0.2,and current version is 4.1.0. Could someone take a look at it and modify it to work on latest sdk? I don't have time,nor knowledge to do it. Thanks :D
http://edorul.free.fr/psp/pspgl_modified.rar
if I add a test for gcc version to typedef or not uint32_t by changing/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/include/stdint.h:84: error: conflicting types for 'uint32_t'
pspgl_misc.h:10: error: previous declaration of 'uint32_t' was here
Code: Select all
typedef unsigned uint32_t;
Code: Select all
#define __GCC_VERSION(major,minor,patchlevel) (((major)*10000)+(minor*100)+(patchlevel))
#define __GCCV __GCC_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
#if defined(__GNUC__) && (__GCCV < __GCC_VERSION(4,1,0))
typedef unsigned uint32_t;
#endif
pspgl_misc.h:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lg2'
Code: Select all
static inline uint32_t lg2(unsigned int x) __attribute__((const,always_inline));
static inline uint32_t lg2(unsigned int x)
{
if (__builtin_constant_p(x))
switch(x) {
case 1: return 0;
case 2: return 1;
case 4: return 2;
case 8: return 3;
case 16: return 4;
case 32: return 5;
case 64: return 6;
case 128: return 7;
case 256: return 8;
case 512: return 9;
case 1024: return 10;
case 2048: return 11;
case 4096: return 12;
case 8192: return 13;
case 16384: return 14;
case 32768: return 15;
case 65536: return 16;
}
return 31 - __builtin_clz(x);
}
intotypedef unsigned uint32_t;
I'm totally able to build all the libs (I didn't ever try to test them after the build process)typedef unsigned long uint32_t;
I did everyting as you told me,but I still have the same error. First lines of my pspgl_misc.h file:
And error:
Code: Select all
#ifndef __pspgl_misc_h__
#define __pspgl_misc_h__
#include <sys/types.h>
#define __GCC_VERSION(major,minor,patchlevel) (((major)*10000)+(minor*100)+(patchlevel))
#define __GCCV __GCC_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
#if defined(__GNUC__) && (__GCCV < __GCC_VERSION(4,1,0))
typedef unsigned long uint32_t;
#endif
/* Return a pointer to uncached address space. The pointer and size
must both be a multiple CACHELINE_SIZE. */
#define CACHELINE_SIZE 64
void *__pspgl_uncached(void *p, size_t size);
/* Round up to a particular power of 2. "a" evaluated multiple
times. */
#define ROUNDUP(x, a) (((x)+((a)-1)) & ~((a)-1))
/* log-base-2 function. */
static inline uint32_t lg2(uint32_t x) __attribute__((const,always_inline));
static inline uint32_t lg2(uint32_t x)
{
if (__builtin_constant_p(x))
switch(x) {
case 1: return 0;
case 2: return 1;
case 4: return 2;
case 8: return 3;
case 16: return 4;
case 32: return 5;
case 64: return 6;
case 128: return 7;
case 256: return 8;
case 512: return 9;
case 1024: return 10;
case 2048: return 11;
case 4096: return 12;
case 8192: return 13;
case 16384: return 14;
case 32768: return 15;
case 65536: return 16;
}
return 31 - __builtin_clz(x);
}
In your case adding long helped,but for me it doesn't work - any other ideas?gambiting@gambiting-desktop:~/psp/pspgl_modified_v0.2$ make
psp-gcc -std=gnu99 -g -Wall -Wmissing-prototypes -Os -G0 -fsingle-precision-constant -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 pspgl_internal.h:14,
from eglBindTexImage.c:1:
pspgl_misc.h:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lg2’
pspgl_misc.h:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lg2’
pspgl_misc.h:52: error: expected ‘)’ before ‘x’
pspgl_misc.h:53: error: expected ‘)’ before ‘x’
pspgl_misc.h:59: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pow2’
pspgl_misc.h:60: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pow2’
pspgl_misc.h:104: error: expected specifier-qualifier-list before ‘uint32_t’
In file included from eglBindTexImage.c:1:
pspgl_internal.h:109: error: expected specifier-qualifier-list before ‘uint32_t’
pspgl_internal.h:148: error: expected specifier-qualifier-list before ‘uint32_t’
pspgl_internal.h:272: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__pspgl_context_register’
In file included from eglBindTexImage.c:1:
pspgl_internal.h: In function ‘getReg’:
pspgl_internal.h:418: error: ‘struct hwstate’ has no member named ‘ge_reg’
make: *** [eglBindTexImage.o] Error 1
gambiting@gambiting-desktop:~/psp/pspgl_modified_v0.2$
My projects:
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
sorry, i wasn't clear.
replace
with
replace
Code: Select all
#define __GCC_VERSION(major,minor,patchlevel) (((major)*10000)+(minor*100)+(patchlevel))
#define __GCCV __GCC_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
#if defined(__GNUC__) && (__GCCV < __GCC_VERSION(4,1,0))
typedef unsigned long uint32_t;
#endif
Code: Select all
typedef unsigned long uint32_t;
Works like a charm,thanks! :D:D:Dhlide wrote:sorry, i wasn't clear.
replace
withCode: Select all
#define __GCC_VERSION(major,minor,patchlevel) (((major)*10000)+(minor*100)+(patchlevel)) #define __GCCV __GCC_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) #if defined(__GNUC__) && (__GCCV < __GCC_VERSION(4,1,0)) typedef unsigned long uint32_t; #endif
Code: Select all
typedef unsigned long uint32_t;
My projects:
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
I still have some problems with glFog,it's working only partialy - I can set color to it,set start and end,but I can't set density.Calling
Gives me GL_INVALID_ENUM error which basically means floating point exception. Any ideas why it happens?
Edit:
here's a quote from official docs
Code: Select all
glFogf(GL_FOG_DENSITY, 0.35f);
Edit:
here's a quote from official docs
pname is the first argument,while params is the second one.Please tell me HOW(?) could 0.35f NOT be a valid argument if a float is requested?I also tried 1.0f,0.1f,0.5f,nothing works.GL_INVALID_ENUM is generated if pname is not an accepted value, or if pname is GL_FOG_MODE and params is not an accepted value.
My projects:
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
here is what glFogf can do :gambiting wrote:I still have some problems with glFog,it's working only partialy - I can set color to it,set start and end,but I can't set density.CallingGives me GL_INVALID_ENUM error which basically means floating point exception. Any ideas why it happens?Code: Select all
glFogf(GL_FOG_DENSITY, 0.35f);
Edit:
here's a quote from official docspname is the first argument,while params is the second one.Please tell me HOW(?) could 0.35f NOT be a valid argument if a float is requested?I also tried 1.0f,0.1f,0.5f,nothing works.GL_INVALID_ENUM is generated if pname is not an accepted value, or if pname is GL_FOG_MODE and params is not an accepted value.
Code: Select all
glFogf(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, near_value);
glFogf(GL_FOG_END, far_value);
Ok,so how can I set fog density?By default it's set to 100%(1.0f) so I can't see anything only fog ;-(hlide wrote:here is what glFogf can do :gambiting wrote:I still have some problems with glFog,it's working only partialy - I can set color to it,set start and end,but I can't set density.CallingGives me GL_INVALID_ENUM error which basically means floating point exception. Any ideas why it happens?Code: Select all
glFogf(GL_FOG_DENSITY, 0.35f);
Edit:
here's a quote from official docspname is the first argument,while params is the second one.Please tell me HOW(?) could 0.35f NOT be a valid argument if a float is requested?I also tried 1.0f,0.1f,0.5f,nothing works.GL_INVALID_ENUM is generated if pname is not an accepted value, or if pname is GL_FOG_MODE and params is not an accepted value.anything else returns GL_INVALID_ENUM as it is your case.Code: Select all
glFogf(GL_FOG_MODE, GL_LINEAR); glFogf(GL_FOG_START, near_value); glFogf(GL_FOG_END, far_value);
My projects:
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
Don't really know how things do work on PSP, but in "plain" openGL glFogf(GL_FOG_DENSITY, someFloatValue); should work...if it is not i begin to wonder it's not supported by pspGl "port", yet. Be sure not to mess with the second parameter; according to the first page i found googling around:
jean
Are you sure you're not passing a pointer or something like it? you could try with glFogi version....but again, don't fully thrust me: while i'm pretty good in "real" openGL, i never tried the psp versionGL_INVALID_VALUE is generated if pname is GL_FOG_DENSITY, and params is negative.
jean
Code from glFog.c:
As you can see,there is no case switch for GL_FOG_DENSITY,so it mean's it's not supported. It kinda sucks,because now this fog looks like a wall :P
Code: Select all
void glFogf (GLenum pname, GLfloat param)
{
float distance;
GLenum error;
error = GL_INVALID_VALUE;
switch (pname) {
case GL_FOG_MODE:
if (param != GL_LINEAR)
goto out_error;
break;
case GL_FOG_START:
pspgl_curctx->fog.near = param;
distance = pspgl_curctx->fog.far - pspgl_curctx->fog.near;
if (unlikely(distance == 0))
goto out_error;
distance = 1.0f / distance;
sendCommandf(CMD_FOG_NEAR, distance);
break;
case GL_FOG_END:
pspgl_curctx->fog.far = param;
// @@@ added by Edorul by this way we can declare GL_FOG_START before GL_FOG_END
// @@@ else we have a strange result (the fog is "inversed")
distance = pspgl_curctx->fog.far - pspgl_curctx->fog.near;
if (unlikely(distance == 0))
goto out_error;
distance = 1.0f / distance;
sendCommandf(CMD_FOG_NEAR, distance);
// @@@ end modif by Edorul
sendCommandf(CMD_FOG_FAR, pspgl_curctx->fog.far);
break;
/**
case XXXX:
pspgl_curctx->fog.XXXXX = param;
sendCommandf(248, ??fog type??);
break;
*/
default:
error = GL_INVALID_ENUM;
goto out_error;
}
return;
out_error:
GLERROR(error);
}
My projects:
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!
PSPSnake
Mandelbrot Fractal Generator
Shoot4Fun
BlowUp!