0 Members and 1 Guest are viewing this topic.
nGL renders only triangles, so is much more flexible in drawing textures at an arbitrary scale, rotation, translation etc., but that comes at the cost of:ClippingCullingZ-BufferInterpolation along X and Y-Axis (With textures: 3 divisions per scanline, without: 1) which wouldn't be necessary for simple 2D stuff. That's also the reason I wrote a basically seperate lib "texturetools.cpp" to do 2d transformations (basically blitting, scaling, font etc.) on TEXTUREs. And yes, it's faster than n2dlib
Quote from: Vogtinator on July 06, 2014, 08:58:30 amnGL renders only triangles, so is much more flexible in drawing textures at an arbitrary scale, rotation, translation etc., but that comes at the cost of:ClippingCullingZ-BufferInterpolation along X and Y-Axis (With textures: 3 divisions per scanline, without: 1) which wouldn't be necessary for simple 2D stuff. That's also the reason I wrote a basically seperate lib "texturetools.cpp" to do 2d transformations (basically blitting, scaling, font etc.) on TEXTUREs. And yes, it's faster than n2dlib Well I personnally didn't know about your 2D lib until recently (after n2Dlib was started) but you should definitely have bragged told about it sooner. The goal of n2Dlib was not to make something new, just to make a lib that runs at the same speed on CXes and non-CXes (and also that used the same format for "sprites" as nSDL). And apparently, not only it's slower on CXes but it's not even fast on the fastest model -.-So could you share a link to your 2D lib and to a documentation about it ?
#include <libndls.h>#include "texturetools.h"#include "font.h"int main(){ TEXTURE *screen = newTexture(SCREEN_WIDTH, SCREEN_HEIGHT); nglInit(); nglSetBuffer(screen->bitmap); while(!isKeyPressed(KEY_NSPIRE_ESC)) { //Draw glColor3f(0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); drawString("Hi!\nThis is a small test!", 0xFFFF, *screen, 0, 0); nglDisplay(); } nglUninit(); deleteTexture(screen);}
Okay so stop saying texturetools is faster than n2DLib : I just looked at your drawTexture routine, it's exactly the same as n2DLib's drawSprite
8e28: e15392b4 ldrh r9, [r3, #-36] ; 0xffffffdc 8e2c: e14292b4 strh r9, [r2, #-36] ; 0xffffffdc 8e30: e15392b2 ldrh r9, [r3, #-34] ; 0xffffffde 8e34: e14292b2 strh r9, [r2, #-34] ; 0xffffffde
Use a Texture struct rather than a unsigned short* for better readability.
It isn't (probably a typo, but drawTexture = drawSpritePart). I know, I probably sound like an asshole now ( ), but I already told you how you could optimize it.
Quote from: Vogtinator on July 06, 2014, 01:58:34 pmUse a Texture struct rather than a unsigned short* for better readability.Well, two of us come from Axe and care less about readability than about speed (even though it seems like we are not Nspire pros ) or efficiency.