Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Ubermeowmix

Member Since 30 Jan 2010
Offline Last Active Yesterday, 01:56 PM

Posts I've Made

In Topic: Anyone got any ideas where 4k a sec is coming from?

30 May 2015 - 12:13 PM

OMG FFS I have found it, the problem was:

 

SDL_RENDERER_PRESENTVSYNC

 

if((Renderer = SDL_CreateRenderer(Window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC ))== nullptr) {
     return false;
}

In Topic: Anyone got any ideas where 4k a sec is coming from?

28 May 2015 - 11:42 AM

4k a sec was a rough estimate as I wanted to get to the point without being anal about the irrelevant bits.

 

It's average at the start fluctuates and goes up and down all the time, but as stated it seems to be exponential from the values.

 

p.s.

As quoted above 4k a sec is not exponential and it was a bad description, apologies.


In Topic: Anyone got any ideas where 4k a sec is coming from?

27 May 2015 - 12:37 PM

No it just keeps on going, like I said it's exponential.

 

I reinstalled Windows 7 in between as I got a new HDD, so this is unlikely to be a corrupted install of windows. The same happened before and after.


In Topic: Anyone got any ideas where 4k a sec is coming from?

26 May 2015 - 12:38 PM

Is this causing an actual problem? Other than the potentially eronous values in taskmanager?

When writing any software, there are too many actual challenges to spend time chasing ghosts.

 

Why is this not important, if I leave this program running for 5-10 mins it ends up as a 160mb file size instead of a 5mb one that it should be.

 

Am I missing the point here, games in my experience don't randomly Octuple themselves into infinity.


In Topic: Anyone got any ideas where 4k a sec is coming from?

25 May 2015 - 02:27 PM

I'm still no closer to figuring out why my program is causing infinitely exponential 4k from what seems to be SDL_RenderPresent(Renderer);

 

Any ideas, i've isolated the issue right down to basics:

 

 
#include <SDL2/SDL.h>
 
#include <iostream>
#include <stdio.h>
 
#define WINDOW_HANDLE "BasicEngine strip down"
 
///MAIN VARIABLES
bool appRunning= true;
const int WindowWidth = 1024;
const int WindowHeight = 768;
SDL_Rect screenCoords;
 
SDL_Window* Window= NULL;
SDL_Renderer* Renderer= NULL;
 
///FORWARD DECLARATIONS
bool OnInit();
bool fLoadMedia();
void OnEvent(SDL_Event* Event);
void OnLoop();
void OnRender();
void OnCleanup();
 
int main(int argc, char* argv[])
{
    if(!OnInit()) { return false; }
 
    SDL_Event Event;
 
while(appRunning)
{
while(SDL_PollEvent(&Event)!= 0)
        {
OnEvent(&Event);
}
 
OnRender(); ///WTF ARE THESE CAUSING EXPONENTIAL MEMORY CREATION!?
}
 
OnCleanup();
 
return false;
}
 
bool OnInit()
{
    if(SDL_Init(SDL_INIT_VIDEO)!= 0)
    {
        printf("Unable to Init SDL: %s", SDL_GetError());
        return false;
    } else {
        if( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ) )
{
printf( "Warning: Linear texture filtering not enabled!" );
}
 
        if(
        (Window=
        SDL_CreateWindow(
        WINDOW_HANDLE,
        SDL_WINDOWPOS_UNDEFINED,
        SDL_WINDOWPOS_UNDEFINED,
        WindowWidth,
        WindowHeight,
        SDL_WINDOW_SHOWN)
        )==nullptr)
        {
            return false;
        }
 
        if((Renderer = SDL_CreateRenderer(Window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC ))== nullptr) {
            return false;
        }
    }
 
    return true;
}
 
void OnEvent(SDL_Event* Event)
{
    if(Event->type== SDL_QUIT) appRunning= false;
    if(Event->type== SDL_KEYDOWN)
    {
        switch(Event->key.keysym.sym)
        {
            case SDLK_ESCAPE:
                appRunning= false;
            break;
        }
    }
}
 
void OnRender()
{
    ///WTF ARE THESE CAUSING EXPONENTIAL MEMORY CREATION!?
    SDL_SetRenderDrawColor(Renderer, 100, 0x00, 200, 0xFF);
    SDL_RenderClear(Renderer);
 
    ///UPDATE THE SCREEN
    SDL_RenderPresent(Renderer);
}
 
void OnCleanup()
{
    if(Renderer)
    {
        SDL_DestroyRenderer(Renderer);
        Renderer= nullptr;
    }
 
    if(Window)
    {
        SDL_DestroyWindow(Window);
        Window= nullptr;
    }
    
    SDL_Quit();
}
 

PARTNERS