Open GL API Error Reporting

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Open GL API Error Reporting

Post by PH3NOM »

Hi guys, thanks for your interest in the Open GL API I have released recently here.

There have been a few minor bugs reported in the forums here, so in order to keep things centralized, I am starting this thread for that purpose.

Any bugs you experience in the API, please post them here so I can look at the problem and create a fix if it is in fact a problem in the API.

Thanks again and happy coding!

-Josh
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by bogglez »

void glNormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer) doesn't take a size argument, normals always have 3 components.

The example basic/elements/main.c needs to be fixed in this regard, too.
glNormalPointer(3, GL_FLOAT, 0, NORMAL_ARRAY);
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Open GL API Error Reporting

Post by PH3NOM »

Thank you for catching that.

+Added to the list of changes I will make when I get some time.

Hopefully I can finish my homework today with enough time left to work on some DC stuff.
User avatar
Indiket
DC Developer
DC Developer
Posts: 99
Joined: Sun Sep 05, 2010 5:44 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by Indiket »

Hey PH3NOM! Let me add my stubborn request :)

+ Fix OpenGL compatibility with the SDL library (of kos-ports).
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Open GL API Error Reporting

Post by PH3NOM »

bogglez wrote:void glNormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer) doesn't take a size argument, normals always have 3 components.

The example basic/elements/main.c needs to be fixed in this regard, too.
glNormalPointer(3, GL_FLOAT, 0, NORMAL_ARRAY);
That Error has been fixed in the API, along with some other minor changes.
Grab the latest commit to get the most recent build.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Open GL API Error Reporting

Post by PH3NOM »

Indiket wrote:Hey PH3NOM! Let me add my stubborn request :)

+ Fix OpenGL compatibility with the SDL library (of kos-ports).
To be fair, those changes need to be made to SDL, not my API :lol:
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by Jae686 »

Problems while compiling examples :

Code: Select all

make[4]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/kgl/demos/mipmap'
make -C  multitexture
make[4]: Entering directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/kgl/demos/multitexture'
make[4]: *** No targets specified and no makefile found.  Stop.
make[4]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/kgl/demos/multitexture'
make[3]: *** [_dir_multitexture] Error 2
make[3]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/kgl/demos'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/kgl'
/bin/sh: 1: exit: Illegal number: -1
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast'
make: *** [all] Error 2


Goamon
DCEmu Newbie
DCEmu Newbie
Posts: 5
Joined: Sat Jun 28, 2014 4:14 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by Goamon »

Thanks PH3NOM for this new opengl api.

As mention above, multitexture example is missing and there are troubles with blur and specular examples on real hardware.
dc-tool logs:

Blur:

Code: Select all

$ dc-tool -x examples/dreamcast/kgl/demos/blur/radial_blur.elf -t 192.168.1.203
Console enabled
Upload <examples/dreamcast/kgl/demos/blur/radial_blur.elf>
File format is ELF, start address is 0x8c010000
Section .text, lma 0x8c010000, size 277728
Section .init, lma 0x8c053ce0, size 54
Section .fini, lma 0x8c053d18, size 42
Section .rodata, lma 0x8c053d44, size 65940
Section .eh_frame, lma 0x8c063ed8, size 116
Section .ctors, lma 0x8c063fcc, size 8
Section .dtors, lma 0x8c063fd4, size 8
Section .jcr, lma 0x8c063fdc, size 4
Section .data, lma 0x8c063fe0, size 12400
Section .got, lma 0x8c067050, size 12
transferred 356312 bytes at 449296.067656 bytes / sec
Executing at <0x8c010000>
Sending execute command (0x8c010000, console=1, cdfsredir=0)...executing

--
KallistiOS Git revision ad11962: dim. 19 oct. 2014 11:31:54
  Damien@Damien-PC:/home/Damien/Tools/dreamcast/KallistiOS
thd: pre-emption enabled, HZ=100
maple: active drivers:
    Dreameye (Camera): Camera
    Sound Input Peripheral: Microphone
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
  DMA Buffer at ac1cf980
vid_set_mode: 640x480 NTSC
fs_romdisk: mounting image at 0x8c053e10 at /rd
dc-load console support enabled
maple: attached devices:
  A0: Dreamcast Controller          (01000000: Controller)
  A1: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
  A2: Puru Puru Pack                (00010000: JumpPack)
glRadialBlur beginning
pvr: disabling vertical scaling for VGA
Unhandled exception: PC 8c014602, code 1, evt 0100
 R0-R7: 8c01458c 00000000 00000000 8c0676c0 8c0670c8 8c067764 8cfffeec 00000002
 R8-R15: 00000000 00000000 8c06774c 8c1e3ae0 8c0670ac 8c0676ec 8c0676f0 8cfffee8
 SR 40000001 PR 8c0111a8
-------- Stack Trace (innermost first) ---------
   00000001
   (invalid frame pointer)
-------------- End Stack Trace -----------------
kernel panic: unhandled IRQ/Exception
arch: aborting the system
Specular:

Code: Select all

2.168.1.203x KallistiOS/examples/dreamcast/kgl/demos/specular/specular.elf -t 192
Console enabled
Upload <KallistiOS/examples/dreamcast/kgl/demos/specular/specular.elf>
File format is ELF, start address is 0x8c010000
Section .text, lma 0x8c010000, size 285728
Section .init, lma 0x8c055c20, size 54
Section .fini, lma 0x8c055c58, size 42
Section .rodata, lma 0x8c055c84, size 625056
Section .eh_frame, lma 0x8c0ee624, size 116
Section .ctors, lma 0x8c0ee718, size 8
Section .dtors, lma 0x8c0ee720, size 8
Section .jcr, lma 0x8c0ee728, size 4
Section .data, lma 0x8c0ee740, size 12464
Section .got, lma 0x8c0f17f0, size 12
transferred 923492 bytes at 977184.372522 bytes / sec
Executing at <0x8c010000>
Sending execute command (0x8c010000, console=1, cdfsredir=0)...executing

--
KallistiOS Git revision ad11962: dim. 19 oct. 2014 11:31:54
  Damien@Damien-PC:/home/Damien/Tools/dreamcast/KallistiOS
thd: pre-emption enabled, HZ=100
maple: active drivers:
    Dreameye (Camera): Camera
    Sound Input Peripheral: Microphone
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
  DMA Buffer at ac25d100
vid_set_mode: 640x480 NTSC
fs_romdisk: mounting image at 0x8c055da4 at /rd
dc-load console support enabled
maple: attached devices:
  A0: Dreamcast Controller          (01000000: Controller)
  A1: Visual Memory                 (0e000000: Clock, LCD, MemoryCard)
  A2: Puru Puru Pack                (00010000: JumpPack)
pvr: disabling vertical scaling for VGA
Unhandled exception: PC 8c016542, code 1, evt 0100
 R0-R7: 8c0164cc 00000000 00000000 8c0f1e5c 8c0f18c4 8c0f1f04 8cfffd54 00000002
 R8-R15: 00000001 00000060 8c0f1eec 8c671268 8c0f1848 8c0f1e88 8c0f1e8c 8cfffd50
 SR 40000101 PR 8c013828
-------- Stack Trace (innermost first) ---------
   00000002
   (invalid frame pointer)
-------------- End Stack Trace -----------------
kernel panic: unhandled IRQ/Exception
arch: aborting the system
Kos has been compiled with gcc-4.7.3 and mimap example works well.
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Open GL API Error Reporting

Post by PH3NOM »

Thank you for your interest.

Not sure whats up with that.
As soon as I get some time, I will take a look and see if I can re-create the problem.
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by bogglez »

Concerning compressed textures:
Ph3nom, I realized you added defines for VQ_*_REV textures (BGR instead of RGB, right?). But as far as I know the PVR does not support those. I think those defines should be removed?

Also, what about implementing glCompressedTexImage2D? The difference to glTexImage2D is that the input data is already compressed. With glTexImage2D the input data would be compressed during runtime.

The basic idea would be:
1. In the Makefile:

Code: Select all

$(TARGET): ... logo.kmg # Make binary depend on generated textures

logo.kmg: logo.png # How to generate the compressed texture
  vqenc -t -m -k $^
2. Load compressed texture from file

Code: Select all

GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glCompressedTexImage2D(GL_TEXTURE_2D, level=0, internalFormat=GL_KOS_ARGB1555_TWIDDLEVQ, kmg.w, kmg.h, border=0, kmg.byte_count, kmg.data);
(I think we'll want to add a utility function that accepts a kmg file and returns an opengl texture id here).


vqenc now also supports ARGB1555 in addition to ARGB4444 and RGB565. Those should be the most important formats for games.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Goamon
DCEmu Newbie
DCEmu Newbie
Posts: 5
Joined: Sat Jun 28, 2014 4:14 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by Goamon »

PH3NOM wrote:Thank you for your interest.

Not sure whats up with that.
As soon as I get some time, I will take a look and see if I can re-create the problem.
Hi PH3NOM,

I try again with the blur and specular example and I think the problem is in gl-sh4-light.S file. :(

Code: Select all

$ sh-elf-addr2line.exe -e radial_blur.elf 8c014602
gl-sh4-light.o:?

Code: Select all

$ sh-elf-addr2line.exe -e specular.elf 8c016542
gl-sh4-light.o:?
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Open GL API Error Reporting

Post by PH3NOM »

bogglez-
Good idea to add support for run-time vq-compression ( I don't think this has been implemented in KOS yet? ), and supporting glCompressedTexImage2D.
I would like to add that ability to KOS, and then implement into GL. Right now my time is very scarce, but I add that to my queue of things to do when I get some free time.

Goamon-
That is very strange because that is the only source file that has not been modified since the initial GL release, and I can verify that it works on real hardware.
Can you test without using dc-load?
Goamon
DCEmu Newbie
DCEmu Newbie
Posts: 5
Joined: Sat Jun 28, 2014 4:14 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by Goamon »

I only have a BBA for now. I bought a sd adapter, I will try when I receive it.

I debug with eclipse CDT the two examples and I found where the problem is.
When the instruction fmov is reached in gl-sh4-light.S, I got a BUS error on both examples.

Code: Select all

 .WRITEDi:
8c014600:   fschg 
8c014602:   fmov fr4,@r6
I build the toolchain with cygwin, maybe this is the problem?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Open GL API Error Reporting

Post by BlueCrab »

The exception code generated and everything else you've described implies here that r6 is not aligned properly on a write instruction. r6 must be a multiple of 8 for that instruction, as it is doing a double precision move (in the actual code, the fschg changes to double-precision mode and the fmov dr4, @r6 instruction does the double precision write).

Looking at the code, it does appear that this is indeed possible. Try making the following changes to gl-light.c and see if it helps:

On line 399, add __attribute__(aligned(8))), like so:

Code: Select all

    float L[4] __attribute__((aligned(8)));
Do the same on line 449, and line 494. Then recompile the library and the example program and see if that helps.

As for why you're the only one so far to see that problem, I dunno. Perhaps there's something odd in your compiler, but it doesn't hurt to try to align the variables either way.
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by bogglez »

PH3NOM wrote:bogglez-
Good idea to add support for run-time vq-compression ( I don't think this has been implemented in KOS yet? ), and supporting glCompressedTexImage2D.
I would like to add that ability to KOS, and then implement into GL. Right now my time is very scarce, but I add that to my queue of things to do when I get some free time.
Actually I think the runtime compression is less important, since it should be avoided anyway.. People should just do it at build time. I can't think of valid cases where one would have to compress during runtime.

glCompressedTexture2D however I consider high priority because it saves on VRAM and bandwidth when transferring textures from disk/ram to VRAM, thereby allowing for more and higher resolution textures as well as making texture swapping more feasible when not all textures of the scene fit into VRAM.

I think the PVR API already allows compressed textures, I'm experimenting with it right now in my libgl. You can use the KMG loading functions and extract the compressed texture type (VQ? Twiddled? ARGB1555/ARGB4444/RGB565?) from the container format, use vqenc as I described to get a kmg file.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Goamon
DCEmu Newbie
DCEmu Newbie
Posts: 5
Joined: Sat Jun 28, 2014 4:14 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by Goamon »

BlueCrab wrote:The exception code generated and everything else you've described implies here that r6 is not aligned properly on a write instruction. r6 must be a multiple of 8 for that instruction, as it is doing a double precision move (in the actual code, the fschg changes to double-precision mode and the fmov dr4, @r6 instruction does the double precision write).

Looking at the code, it does appear that this is indeed possible. Try making the following changes to gl-light.c and see if it helps:

On line 399, add __attribute__(aligned(8))), like so:

Code: Select all

    float L[4] __attribute__((aligned(8)));
Do the same on line 449, and line 494. Then recompile the library and the example program and see if that helps.

As for why you're the only one so far to see that problem, I dunno. Perhaps there's something odd in your compiler, but it doesn't hurt to try to align the variables either way.
I recompile the library with aligned attributes and the two examples work perfectly now.
I will build the toolchain on linux with the same gcc version and see if the problem appear.

Thanks.
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by bogglez »

I think glTexImage2D's type parameter has been misunderstood. It's not the type for the internally stored texture, but the type of the source texture.

format=GL_RGB, type=GL_UNSIGNED_BYTE means struct { unsigned char r, g, b};
format=GL_RGBA, type=GL_FLOAT means struct {float r, g, b, a};

Due to the packed pixels extension you can also do:
format=GL_RGB, type=GL_UNSIGNED_SHORT_5_6_5. This means that the SOURCE texture is an array of uint16_t rgb565.

BTW internalFormat is a HINT.. you could basically ignore it if you want, but you should pick a similar format. For example the user picks GL_RGB10 but the PVR doesn't support it, so you pick RGB565 internally.

EDIT:
To elaborate a bit..
Right now the glTexImage2D API in libgl only supports formats which map 1-to-1 to the internal representation, e.g. there is PVR_TXRFMT_RGB565, so format=GL_RGB, type=GL_UNSIGNED_SHORT_5_6_5 is allowed. However, format=GL_RGB, type=GL_UNSIGNED_BYTE is not allowed. At load time, it should be converted to PVR_TXRFMT_RGB565 internally, instead of doing a simple memcpy.

Next, VQ and twiddle should not be specified in type. As I stated in a post before, those should be handled in glCompressedTexImage2D.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by bogglez »

I noticed some issues with glBlendFunc. Some blend factors that exist in OpenGL are not supported by the PVR. libgl will silently set the blend factor to something else or not do anything at all, if the factor is not handled.
I think it would be more sane to set the blend factor to the default (GL_ZERO or GL_ONE) and report an error. The missing factors need to be added (listed in https://www.opengl.org/sdk/docs/man2/xh ... ndFunc.xml)

EDIT:
Question: libgl never sets blend.src_enable and .dst_enable to 1, it just applies the blend function. Why is there any blending then?

EDIT 2:
Here is my implementation:
Spoiler!

Code: Select all

void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) {
	if(isImmediateModeActive()) {
		glSetError(GL_INVALID_OPERATION);
		return;
	}

	if(!isValidBlendSourceFactor(sfactor) || !isValidBlendDestFactor(dfactor)) {
		glSetError(GL_INVALID_ENUM);
		return;
	}

	polygonContext.blend.src = glBlendFactorToPVR(sfactor, GL_ONE);
	polygonContext.blend.dst = glBlendFactorToPVR(dfactor, GL_ZERO);
}

Code: Select all

/**
 * Converts an OpenGL (source or destination) blend factor to the PVR
 * equivalent, if it exists.
 * @param factor The OpenGL blend factor to convert.
 * @param fallbackFactor The PVR blend factor to use when no conversion is possible.
 * @return The PVR equivalent blend factor, or fallbackFactor if it does not exist.
 */
static unsigned glBlendFactorToPVR(GLenum factor, unsigned const fallbackFactor) {
	assert(isValidBlendSourceFactor(factor) || isValidBlendDestFactor(factor));

	switch(factor) {
		case GL_ZERO:                return PVR_BLEND_ZERO;
		case GL_ONE:                 return PVR_BLEND_ONE;
		case GL_DST_COLOR:           return PVR_BLEND_DESTCOLOR;
		case GL_ONE_MINUS_DST_COLOR: return PVR_BLEND_INVDESTCOLOR;
		case GL_SRC_ALPHA:           return PVR_BLEND_SRCALPHA;
		case GL_ONE_MINUS_SRC_ALPHA: return PVR_BLEND_INVSRCALPHA;
		case GL_DST_ALPHA:           return PVR_BLEND_DESTALPHA;
		case GL_ONE_MINUS_DST_ALPHA: return PVR_BLEND_INVDESTALPHA;

		case GL_SRC_COLOR:
		case GL_ONE_MINUS_SRC_COLOR:
		case GL_CONSTANT_COLOR:
		case GL_ONE_MINUS_CONSTANT_COLOR:
		case GL_CONSTANT_ALPHA:
		case GL_ONE_MINUS_CONSTANT_ALPHA:
		case GL_SRC_ALPHA_SATURATE:
		break;

		// Missing blend factor
		default: assert(0);
	}

	glSetError(GL_KOS_UNSUPPORTED);
	return fallbackFactor;
}
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Open GL API Error Reporting

Post by bogglez »

I found another bug affecting all gl*Pointer functions. They don't handle various strides.
For example I have a vertex struct { float x, y, z, u, v; } which is impossible to draw using glDrawArrays, because glKosArraysTransformPositions will always perform P += 3 (skips 3 floats).
Therefore kgl's glDrawArrays will silently use my u, v as the next x, y which results in garbage on screen.

For now those functions should complain when the stride is set to a different value than the expected one. The stride is a very basic feature which is required to support different vertex formats, so it should be implemented though :)

Screenshot is a comparison of jae686's demo framework (modified not to use immediate mode but glDrawArrays) compiled with libgl and libgl15 (my libgl playground).
Attachments
kgl_glpointerbug_2014-11-29.png
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Open GL API Error Reporting

Post by PH3NOM »

Stride should be fine. You are misunderstanding the internal function glKosArraysTransformPositions.
That function operates internally on a vertex array that is built by the API and is guaranteed to be of fixed vertex size.
Consider the code in the same source file that builds the texture coordinates portion of the output, based on either 16bit or 8bit indices:
Spoiler!

Code: Select all

//== Texture Coordinates ==//

static inline void _glKosElementTexCoord2fU16(pvr_vertex_t *dst, GLuint count) {
    GLuint i, index;
    GLfloat *t = GL_TEXCOORD_POINTER;

    for(i = 0; i < count; i++) {
        index = GL_INDEX_POINTER_U16[i] * GL_TEXCOORD_STRIDE;
        dst[i].u = t[index];
        dst[i].v = t[index + 1];
    }
}

static inline void _glKosElementTexCoord2fU8(pvr_vertex_t *dst, GLuint count) {
    GLuint i, index;
    GLfloat *t = GL_TEXCOORD_POINTER;

    for(i = 0; i < count; i++) {
        index = GL_INDEX_POINTER_U8[i] * GL_TEXCOORD_STRIDE;
        dst[i].u = t[index];
        dst[i].v = t[index + 1];
    }
}
By chance is the code using 2D vertices in glDrawArrays?
That is currently not supported by the code in the API. glDrawArrays currently only supports 3D vertices.

Otherwise, I would need to look at the code in question and see whats going on in the API.

-Josh
Post Reply