Welcome! Log In Create A New Profile

Advanced

Fps from 60 to 12?!?

Posted by filfat 
Fps from 60 to 12?!?
November 25, 2012 02:48PM
i have made a simpel block placment game and wen i place one block will it drop to 12 fps from 60! -_- easy way to fix this?
//Standard libray:
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
//Home menu:
//Coming Soon
//GRRLIB:
#include 

//Classes:
#include "Blocks.h"
#include "oggplayer.h"
#include "drawcube.h"
//#include "NETWORK_SERVER.H"
//#include "minecraft.h"

//Fonts:
#include "minecraftFont_ttf.h"
#include "gfx/BMfont5.h"

//Images:
#include "terrain_png.h"
#include "gfx/mojang.h"
#include "gfx/pointer1.h"
#include "gfx/pointer2.h"
//#include "gfx/pointer3.h"
//#include "gfx/pointer4.h"
#include "gfx/grrlib_logo.h"
#include "gfx/panorama4.h"

//OGG:
#include "main_ogg.h"

//Server:
/*#include"_FindFirst.h"
#include"AutopatcherPatchContext.h"
#include"AutopatcherRepositoryInterface.h"
#include"BitStream.h"
#include"CCRakNetSlidingWindow.h"
#include"CCRakNetUDT.h"
#include"CheckSum.h"
#include"CloudClient.h"
#include"CloudCommon.h"
#include"CloudServer.h"
#include"CommandParserInterface.h"
#include"ConnectionGraph2.h"
#include"ConsoleServer.h"
#include"DataCompressor.h"
#include"RakPeer.h"
#include"RakPeerInterface.h"
#include"SimpleTCPServer.h"
#include"NetworkIDManager.h"
#include
#include
#include"RakPeerInterface.h"
#include"MessageIdentifiers.h"
#include"RakNetTime.h"
#include"RakNetTypes.h"
#include"SendToThread.h"
#include"BitStream.h"
#include"RakNetDefines.h"
#include"NetworkIDManager.h"
#include"RakNetTypes.h"*/

//RGBA Colors
#define BLACK  0x000000FF
#define MAROON  0x800000FF
#define GREEN  0x008000FF
#define OLIVE  0x808000FF
#define NAVY    0x000080FF
#define PURPLE  0x800080FF
#define TEAL    0x008080FF
#define GRAY    0x808080FF
#define SILVER  0xC0C0C0FF
#define RED    0xFF0000FF
#define LIME    0x00FF00FF
#define YELLOW  0xFFFF00FF
#define BLUE    0x0000FFFF
#define FUCHSIA 0xFF00FFFF
#define AQUA    0x00FFFFFF
#define WHITE  0xFFFFFFFF
//Wiilight
#define HW_GPIO            0xCD0000C0;

#define DISC_SLOT_LED      0x20
//DEBUG:
#define DEBUG                0
//Server:
#define MAX_CLIENTS 6
#define SERVER_PORT 19132

using namespace std;
//using namespace minecraft;

    //Initialize the IR
    ir_t ir1;
    ir_t ir2;
    //ir_t ir3;
    //ir_t ir4;

    //--------------------------------------------------
    //Wiilight
    //--------------------------------------------------
    lwp_t light_thread = 0;

    void *light_loop (void *arg);

    vu32 *light_reg = (u32*) HW_GPIO;

    bool light_on = false;

    u8 light_level = 0;

    struct timespec light_timeon = { 0 };

    struct timespec light_timeoff = { 0 };


    static u8 CalculateFrameRate();

    //----------------------------------------------------------
    //Function's:
    //----------------------------------------------------------

    void WIILIGHT_TurnOn()
    {

    *(u32*)0xCD0000C0 |= 0x20;

}
    void WIILIGHT_TurnOff()
    {
    *(u32*)0xCD0000C0 &= ~0x20;
}
void WIILIGHT_SetLevel(int level)
    {

    light_level = MIN(MAX(level, 0), 100);



    // Calculate the new on/off times for this light intensity

    u32 level_on;

    u32 level_off;

    level_on = (light_level * 2.55) * 40000;

    level_off = 10200000 - level_on;

    light_timeon.tv_nsec = level_on;

    light_timeoff.tv_nsec = level_off;

}



    void init(){
    //Disk light turn on and init
    //WIILIGHT_Init();
    WIILIGHT_SetLevel(255);
    WIILIGHT_TurnOn();
    // Initialise the Graphics & Video subsystem
    GRRLIB_Init();
    //VIDEO_Init();
    // button initialization
    WPAD_Init();
    WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
    // Initialse the sound system
    ASND_Init();
    //MP3Player_Init(); /*filfat: We don't need this for the moment...*/

    //Disk light turn off
    WIILIGHT_TurnOff();
}

void cleanup(){
    //ToDo
    GRRLIB_Exit();
    exit(EXIT_SUCCESS);
}

void network();

int main()  {

    init();

    //-------------------------------------------------
    //RAKNET
    //-------------------------------------------------
    /*
    RakNet::RakPeerInterface *peer = RakNet::RakPeerInterface::GetInstance();

    bool isServer;
    RakNet::Packet *packet;
    RakNet::BitStream bsOut;

    RakNet::SocketDescriptor sd(SERVER_PORT,0);
    peer->Startup(MAX_CLIENTS, &sd, 1);
    isServer = 0;
    */
    //-------------------------------------------------
    //RAKNET
    //-------------------------------------------------
    u8 FPS = 0;
    //int version = 0.3;
    int blockInInventory = 1;
    //int xb = 13;
    //int yb = 12;
    int lookingAttX = 0;
    int lookingAttZ = 0;
    int lookingAttY = 0;
    const int sizex = 32;
    const int sizey = 32;
    const int sizez = 32;
    //int saveX;
    //int saveY;
    //int saveZ;
    bool save_used = false;
    int aUsed = 0;

    //Gets the IR positions
    WPAD_IR(WPAD_CHAN_1, &ir1);
    //WPAD_IR(WPAD_CHAN_2, &ir2);
    //WPAD_IR(WPAD_CHAN_3, &ir3);
    //WPAD_IR(WPAD_CHAN_4, &ir4);

    GRRLIB_ttfFont *minecraftFont = GRRLIB_LoadTTF(minecraftFont_ttf, minecraftFont_ttf_size);
    GRRLIB_texImg *tex_pointer1 = GRRLIB_LoadTexture(pointer1);
    GRRLIB_texImg *tex_pointer2 = GRRLIB_LoadTexture(pointer2);
    GRRLIB_texImg *terrain = GRRLIB_LoadTexture(terrain_png);
    //GRRLIB_texImg *panorama4 = GRRLIB_LoadTexture(panorama4);
    GRRLIB_texImg *tex_BMfont5 = GRRLIB_LoadTexture(BMfont5);
    GRRLIB_InitTileSet(tex_BMfont5, 8, 16, 0);

    //--------------------------------------------------
    block Stone("Stone", 31, 15, 1);
    block Grass("Grass", 63, 15, 2);
    block Dirt("Dirt", 47/*filfat: can do wrong with the pixels.. please fix this joshua*/, 15, 3);
    block CobbleStone("CobbleStone", 15, 31, 4);
    //--------------------------------------------------


    //-----------------------------------------------------
    u8 world[sizex][sizey][sizez];
    //-----------------------------------------------------

    GRRLIB_Settings.antialias = false;

    //PlayOgg(main_ogg, main_ogg_size, 0, OGG_ONE_TIME);
    GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
    GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);

    drawcube cube(lookingAttX, lookingAttZ, lookingAttY);

    //Loop forever
    while (1){

    GRRLIB_2dMode();
    WPAD_SetVRes(0, 640, 480);
    WPAD_ScanPads();

    WPAD_IR(0, &ir1);
    WPAD_IR(0, &ir2);
    //WPAD_IR(0, &ir3);
    //WPAD_IR(0, &ir4);

    GRRLIB_DrawImg(ir1.sx - 48, ir1.sy - 45, tex_pointer1, 0, 1, 1, 0xffffffff);
    //GRRLIB_DrawImg(ir2.sx - 48, ir2.sy - 45, tex_pointer2, 0, 1, 1, 0xffffffAA);
    //GRRLIB_DrawImg(ir3.sx - 48, ir3.sy - 45, tex_pointer3, 0, 1, 1, 0xffffffAA);
    //GRRLIB_DrawImg(ir4.sx - 48, ir4.sy - 45, tex_pointer4, 0, 1, 1, 0xffffffAA);
    GRRLIB_Render();

    cube.drawcube_normal(lookingAttX, lookingAttZ, lookingAttY);

    if(save_used){
        for(int x = 0;x <= sizex; x++){
            for(int y = 0;y <= sizey; y++){
                for(int z = 0;z <= sizez; z++){
                    if(world[x][y][z] == true){
                        do{
                        cube.drawcube_save(x,z,y);
                        }while(!1);
                    }
                }
            }
        }
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) {
        cleanup();
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_B) {
        world[lookingAttX][lookingAttY][lookingAttZ] = 0;
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) {
   
        world[lookingAttX][lookingAttY][lookingAttZ] = blockInInventory;
   
        save_used = true;
   
        /*for(int x = 0;x <= sizex; x++){
            for(int y = 0;y <= sizey; y++){
                for(int z = 0;z <= sizez; z++){
                    if(world[lookingAttX][lookingAttY][lookingAttZ]){
                            saveX = lookingAttX;
                            saveY = lookingAttY;
                            saveZ = lookingAttZ;
                            save_used = true;
                   
                    }
                }
            }
        }*/
        aUsed++;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_MINUS) {
   
        lookingAttZ--;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_PLUS) {
   
        lookingAttZ++;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_UP) {
   
        lookingAttY++;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_DOWN) {
   
        lookingAttY--;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_RIGHT) {
   
        lookingAttX++;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_LEFT) {
   
        lookingAttX--;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_1) {
   
        blockInInventory++;
   
    }

    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_2) {
   
        if(blockInInventory){
            blockInInventory--;
        }
   
    }

    GRRLIB_Printf(5, 18, tex_BMfont5, WHITE, 1, "Minecraft Wii Edition 0.3");
    GRRLIB_Printf(5, 39, tex_BMfont5, WHITE, 1, "Current FPS: %d", FPS);
    GRRLIB_Printf(5, 57, tex_BMfont5, WHITE, 1, "X: %d", static_cast(lookingAttX));
    GRRLIB_Printf(5, 76, tex_BMfont5, WHITE, 1, "Y: %d", static_cast(lookingAttY));
    GRRLIB_Printf(5, 95, tex_BMfont5, WHITE, 1, "Z: %d", static_cast(lookingAttZ));

    //GRRLIB_Render();
    FPS = CalculateFrameRate();


    }

    GRRLIB_FreeTexture(terrain);
    GRRLIB_FreeTexture(tex_pointer1);
    GRRLIB_FreeTexture(tex_pointer2);
    //GRRLIB_FreeTexture(panorama4);
    GRRLIB_FreeTexture(tex_BMfont5);
    GRRLIB_FreeTTF(minecraftFont);

    cleanup();

    exit(0);
}

static u8 CalculateFrameRate() {
    static u8 frameCount = 0;
    static u32 lastTime;
    static u8 FPS = 0;
    u32 currentTime = ticks_to_millisecs(gettime());

    frameCount++;
    if(currentTime - lastTime > 1000) {
        lastTime = currentTime;
        FPS = frameCount;
        frameCount = 0;
    }
    return FPS;
}

void network(){
    #ifdef DEBUG
    //GRRLIB_Printf(200, 27, tex_BMfont5, WHITE, 1, "Current ip:");
    #endif
}



Edited 1 time(s). Last edit at 11/25/2012 04:37PM by filfat.
Re: Fps form 60 to 12?!?
November 25, 2012 04:29PM
It's hard to tell without looking at it closely, so I'll just give it a shot: you iterate 32^3 times to draw one cube. What happens if you draw that one cube without iterating over that 32768 array?
Re: Fps form 60 to 12?!?
November 25, 2012 04:34PM
it wont lagg... how can i fix this?
Re: Fps form 60 to 12?!?
November 25, 2012 04:34PM
any easy render code?
Re: Fps from 60 to 12?!?
November 25, 2012 04:42PM
i need to fix the render part but how:
if(save_used){
        for(int x = 0;x <= sizex; x++){
            for(int y = 0;y <= sizey; y++){
                for(int z = 0;z <= sizez; z++){
                    if(world[x][y][z] == true){
                        do{
                        cube.drawcube_save(x,z,y);
                        }while(!1);
                    }
                }
            }
        }
    }



Edited 1 time(s). Last edit at 11/25/2012 04:42PM by filfat.
Re: Fps from 60 to 12?!?
November 25, 2012 05:18PM
If "cube.drawcube_save(x,z,y);" is not the culprit, then it seems like your 3 dimensional array is not suitable for traversing your world. Maybe try an Octree instead. Depending on what you want to do with it.



Edited 1 time(s). Last edit at 11/25/2012 05:19PM by antibyte.
Re: Fps from 60 to 12?!?
November 25, 2012 05:54PM
Could you also please post the cube.drawcube_save() code? :)
Re: Fps from 60 to 12?!?
November 25, 2012 06:31PM
her is it:
#include 
#include 
#include "drawcube.h"
#include "terrain_png.h"


using namespace std;

drawcube::drawcube(int x, int z, int y){
	GRRLIB_texImg *terrain2 = GRRLIB_LoadTexture(terrain_png);
GRRLIB_3dMode(0.1,1000,45,1,0);
        GRRLIB_SetTexture(terrain2,0);
        GRRLIB_ObjectView(x,y,z, 0,0,0, 1,1,1);
        GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);
        GX_End();
		GRRLIB_2dMode();
	GRRLIB_FreeTexture(terrain2);
}

void drawcube::drawcube_save(int x, int z, int y){
	GRRLIB_texImg *terrain2 = GRRLIB_LoadTexture(terrain_png);
	GRRLIB_3dMode(0.1,1000,45,1,0);
        GRRLIB_SetTexture(terrain2,0);
        GRRLIB_ObjectView(x,y,z, 0,0,0, 1,1,1);
        GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

			GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);
        GX_End();
		GRRLIB_2dMode();
	GRRLIB_FreeTexture(terrain2);
}

void drawcube::drawcube_normal(int x, int z, int y){
	GRRLIB_texImg *terrain2 = GRRLIB_LoadTexture(terrain_png);
	GRRLIB_3dMode(0.1,1000,45,1,0);
        GRRLIB_SetTexture(terrain2,0);
        GRRLIB_ObjectView(x,y,z, 0,0,0, 1,1,1);
        GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);
        GX_End();
		GRRLIB_2dMode();
	GRRLIB_FreeTexture(terrain2);
}

void drawcube::drawcube_withoutLeft(int x, int z, int y){
	GRRLIB_texImg *terrain2 = GRRLIB_LoadTexture(terrain_png);
	GRRLIB_3dMode(0.1,1000,45,1,0);
        GRRLIB_SetTexture(terrain2,0);
        GRRLIB_ObjectView(x,y,z, 0,0,0, 1,1,1);
        GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(-1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(-1.0f,1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);

            GX_Position3f32(1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,-1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,0.0f);
            GX_Position3f32(-1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(1.0f,1.0f);
            GX_Position3f32(1.0f,-1.0f,1.0f);
            GX_Color1u32(0xFFFFFFFF);
            GX_TexCoord2f32(0.0f,1.0f);
        GX_End();
		GRRLIB_2dMode();
	GRRLIB_FreeTexture(terrain2);
}
Re: Fps from 60 to 12?!?
November 25, 2012 06:32PM
if you have sourceforge can i add you to the Wiicraft project. if you want's to help =)
Re: Fps from 60 to 12?!?
November 25, 2012 06:33PM
Re: Fps from 60 to 12?!?
November 25, 2012 06:34PM
adn so you know i are not so good in gx XD



Edited 2 time(s). Last edit at 11/25/2012 06:36PM by filfat.
Re: Fps from 60 to 12?!?
November 25, 2012 06:50PM
I'm not using grrlib myself, but after taking a quick look at GRRLIB_LoadTexture(), it seems to check if the texture is a png, jpg or bmp and then decompresses it on the fly. If this is what happens, then you should not call it on a drawcall basis. Call it once at initialization time and then only set the texture using GRRLIB_SetTexture()
Re: Fps from 60 to 12?!?
November 25, 2012 06:54PM
i can try.
Re: Fps from 60 to 12?!?
November 25, 2012 10:07PM
wont work:
error: 'terrain2' was not declared in this scope
Re: Fps from 60 to 12?!?
November 26, 2012 04:19PM
Quote
filfat
wont work:
error: 'terrain2' was not declared in this scope

That's a compiler error. Make it work. ;)
Re: Fps from 60 to 12?!?
November 26, 2012 05:43PM
Re: Fps from 60 to 12?!?
November 26, 2012 05:46PM
it wont work i need to declare it in every fuction ;-)
Re: Fps from 60 to 12?!?
November 26, 2012 05:59PM
Can you not pass a pointer to it to the function? I'm not really sure, I'm just starting to learn C, but I think that would be how to do it.

i.e. have as one of the function parameters something like GRRLIB_texImg *texture

and then call the function with that parameter as "terrain_png" or whatever, and within the function call GRRLIB_SetTexture(texture);

Again, as I said I don't really know a whole lot about C just yet, but as I understand it, you need to do it something like this. Also, I'm quite confused about how pointers pointers, so I may have made a bit of a mistake in how they work etc.



Edited 1 time(s). Last edit at 11/26/2012 06:03PM by SifJar.
Re: Fps from 60 to 12?!?
November 26, 2012 06:14PM
I can't C only C++ XD

but now is it on 30 insted of 12 (if fixed an bug in the u8 wolrd file ;) )
Re: Fps from 60 to 12?!?
November 26, 2012 06:17PM
anywan thats know a way to remove Thumbs.db.o?
Sorry, only registered users may post in this forum.

Click here to login