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!


WiredCat

Member Since 09 Apr 2011
Online Last Active Today, 07:25 AM

#5222415 Helps! Errors In glGetAttribLocationARB

Posted by WiredCat on 10 April 2015 - 07:42 AM

your shader is bad:

 

uniform mat4 MV;
uniform mat4 Proj;
 
write 
attribute mat4 MV;
attribute mat4 Proj;
 
then glgetattribloaction will return something bigger than -1
 
because you want to fetch attribute location not uniform location



#5219835 From scratch vs Unity

Posted by WiredCat on 28 March 2015 - 11:03 AM

my prevorious post can be matched to this conclusion: why to write all components on the form with winapi when you can use compoents from borland that you place them eaisly on a from, and don't care about api crap. mostly true but still you have the ability to change the code managed by borland




#5219759 From scratch vs Unity

Posted by WiredCat on 27 March 2015 - 07:17 PM

mine uses string class and bitmap/jpeg loading provided by Borland. rest is reinvented wheel.

 

My personal thought is that unity is for children like when you buy a child 'little/small chemist kit' does that mean hes a proffesional explosive maker ?

lets wait till 2040 when all you gonna do ist to connect blocks like in lego and 'the game will be made', thus he will call himself a programmer.

And another thought: when lot of crap is not made by the developer (i think mainly because they are too lazy and lack of knowledge) the final product seems 'shallow', unfinished, just crappy. I had truly awful pleasure playing few games made in unity and all i can say that when i see "Powered by unity" i will throw my phone out of the window in the same time shooting it with a nuclear bomb'

 

Thank you, thank you 




#5219748 From scratch vs Unity

Posted by WiredCat on 27 March 2015 - 06:00 PM

little off topic any good game made in unity?




#5219688 Windows mouse event handling (outside of the target window).

Posted by WiredCat on 27 March 2015 - 01:25 PM

I see two approaches man. One is to check GetCursorPos and test if the cursor is wthing a rect of window left ,top left+width, top+height

 

second is to take the handle from the cursor pos and check if it matches your window hwnd or whatever you draw on (Wors only on pure window)

 

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633558(v=vs.85).aspx

 

anyway first methot id the best




#5218807 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 24 March 2015 - 10:14 AM

So to clarify everything i was using std::vector to load binary file and it was slow thats because i dont want to load it.

 

Topic is about loading text files and everybody was asking why i dont want to use std::vector then i got -rep for that i was replying why not, and magically everyone now thinks i am trying to load 3d model text/binary file, which is not true.




#5218780 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 24 March 2015 - 09:23 AM

damn i am not willing to write a text file model loader spiro just said something that is not true, he thinks i am trying to load models from a text file and i am not i am using binary files for that.

im using text files for other things.




#5218753 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 24 March 2015 - 07:45 AM

no no i meant vector i am loading binary files not text files spiro : D




#5218603 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 23 March 2015 - 02:59 PM

OMG!




#5218596 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 23 March 2015 - 02:42 PM

yeah i was onto it but i dont understand how to: 

 Scan it for newline characters, converting each into a null terminator as you find it.

 

as far as i remember that was something like std::string mystring;

mystring[ \n index ] = NULL; right? i remember that worked for symbian c++ however gave me sometimes non null terminated strings anyway \n consist of two chars so do i have to NULL both or i dont know null first and do not copy the char after it to the main output?




#5218567 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 23 March 2015 - 01:46 PM

i know i know but i wanted that everybody willl understand why i dont want to use it. i found it really slow loading 'big' model files.




#5218557 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 23 March 2015 - 01:11 PM

dynamically increasing the array means something liek that

 

first we have some length array

 

char * p = new char[100];

 

then p.push_back(meme);

char * tmp = new[ p.length * 2];

memcpy(from p to tmp);

delete [] p;

p = tmp;

tmp = NULL;

 

 

so when i make only one new call i cant be convinced because all you do is that you call it by one function that doesnt necessary has to be good.

 

anyway i think fastcall came with the best solution.




#5218530 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 23 March 2015 - 11:58 AM

i just came wit han idea of getting file size and dividing it by char size so by nothing, since text file is a simple char array should that work?

 

and to people that said use vector no i wont because i dont want to recreate the array almost every line.

 

so far i am using file.seekg(0)  to do that didint check that if android allows to goback in the file




#5218442 c++ count lines in txt file and then read these lines without reopening a file

Posted by WiredCat on 23 March 2015 - 06:42 AM

so i have a structure that stores array of strings and i want to read it from file

 

problem is i need to count lines in order to set array length

then close file and reopen it again to actually read lines

 

(using vectors doesnt count i really dont want to do that)

 

 

since code is short (function LoadFromFIle() i post whole unit)

#ifndef stringlistH
#define stringlistH
 
#include <stdio.h>
#include <string>
#include <fstream>
 
typedef std::string AnsiString;
 
struct TStringList
{
        int linecount;
        AnsiString * lines;
        TStringList()
        {
                linecount = 0;
                lines = NULL;
        }
 
        ~TStringList()
        {
                if (lines != NULL) delete [] lines;
        }
 
 
void LoadFromFile(AnsiString fname)
{
        std::ifstream file(fname.c_str());
        std::string str;
        std::string file_contents;
        linecount = 0;
        if (lines != NULL)
        {
                delete [] lines;
                lines = NULL;
        }
 
        while (std::getline(file, str)) linecount = linecount + 1;
 
        file.close();
 
lines = new AnsiString[ linecount ];
int cnt = -1;
        file.open(fname.c_str());
        while (std::getline(file, str))
                {
                cnt = cnt + 1;
                lines[cnt] = str;
                }
 
        file.close();
}
 
 
 
 
};
 
#endif



#5216471 Flying through the sky to reach outerspace

Posted by WiredCat on 14 March 2015 - 11:56 AM

atmospheric scattering






PARTNERS