Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LittleWhite

Pages: [1] 2 3 4 5 6 7 8 ... 20
1
C / C++ /C# / Re: [c++] Bug In 3d
« on: November 02, 2014 »
Note : I tested the .exe that you gave. I could recompile since I don't have Visual Studio nor Windows (and I am a bit lazy at rebooting the machine :D). So, I started your .exe using Wine (which is a kind of of Windows emulator for Linux) and it worked very well, I did not see any bug.
But this make me think that the precision problem needs to be look at. Little tip : I have a 64 bits machine. Maybe the bug is visible only on 32 bits machines ?

2
C / C++ /C# / Re: [c++] Bug In 3d
« on: November 02, 2014 »
Hello,

My guess is : float precision.
Exactly the Hellfire's message : http://www.dbfinteractive.com/forum/index.php?topic=6280.msg81875#msg81875

Try to do test between two floats using an epsilon (like 0.0005 or even less). These "special" tests should be inserted in the render function (the one selecting if a pixel should be drawn or not).

3
C / C++ /C# / Re: [c++] Pointers And Classes
« on: October 27, 2014 »
Well, if you want to get rid of the notation : namespace_name::class, you can use :
Code: [Select]
using namespace namespace_nameIt means that the compiler can look in this namespace, to search for symbols.

But, be careful, using this code in a header can bring you some hurt, since the header is a file which is included (literally, copied) and so, the using namespace can propagate in every file including the header. In one word : don't put using namespace in a header :D

4
C / C++ /C# / Re: [c++] Pointers And Classes
« on: October 25, 2014 »
Hello

Don't worry (or don't panic !)
First, when I opened the main.cpp I saw something that is going to hurt.
Let's see :
Code: [Select]
gfx_buffer* screen_buffer;

screen_buffer->graphics( "p01n3trz t3st", 640,480);
As I told you, this, when running, will crash immediately. I will try to explain it.
screen_buffer, is a pointer to a gfx_buffer. Well, that's fine. But, I pointer is just like, an arrow pointing on something. Here, you don't point on anything and you are trying to use (second line : screen_buffer->graphics(...)) your "pointer on whatever".
It's a bit like having a mail adress as follow :
Quote
vdus<ovn oudsnv
vndusnvsduvsnuo
vndsuivd

Try to reach this :D
And computers are dumb. They will try. More precisely, in fact, screen_buffer does contain a value. Sometimes (when running in Windows debugger) it is 0 (or NULL). Sometimes, it is random. But everytime, it is not what you want.
When you are trying to do : screen_buffer->... (trying to use the pointer) and that it contains 0, it crash (everytime). Since 0 is not a valid pointer.
With random value, it depends on operating system and CPU. Since the random value can point memory that you own, it will not crash, but it is likely to crash (now or later).

So, first advice : Always give a value to a new variable. Trust me, uninitialized variables are not your friends. Uninitialized pointers (since these are variables more or less as others) as to be initialized.
When you don't know which value to use, put 0. It will help you, at least by crashing the program immediately (but the bug will be more visible than just random behaviour).

Ok, it was the first part.
A pointer, litteraly, it's a memory address. It's just a memory address that we put in a variable and that we can follow to reach the memory (or an object stored in memory, or a variable stored in memory).
When you see a pointer :
Code: [Select]
int* pA = NULL; It just means this is a pointer, that will point on a int. So, if you follow the address in the pointer (ok, here, the address is 0 and it will crash), you will find a variable of type int.
More precisely :
Code: [Select]
int myVar = 42;
int* pMyVar = &myVar
Here, I have a variable called "myVar" which contains 42. Ok, it means, in some way, that the computer stored 42 in its memory.
Now, the second line.
&myVar means -> the addresse of myVar.
So, pMyVar, is a pointer leading to a int, which is initialized to the address of myVar. It means, that, when I will follow the pointer (*pMyVar), it will lead me to 42 :)

Second advice : to differentiate the variables with the pointers, I am using a "special" syntax. All my variables that are pointers, are called beginning with 'p'.
At least, it will help me to see if I have to use '.' or '->' syntax.


So, let's go back to your main.cpp
The point is that you have never initialized your pointers. You will have to do it, at the beginning of the main.
To allocate some memory (meaning, telling to the system the program wants to use some memory cells for its own usage), you will use "new" (it's a C++ keyword).
When you want to release the memory (meaning, telling to the system, the program does not need this memory anymore), you will use "delete".

So, at some point, at the very beginning of main, you will see :
Code: [Select]
screen_buffer = new gfx_buffer();Here, it allocates the space needed for a gfx_buffer, and new will return you, the address of this new storage that the OS allowed you to use.
At the very end of main, you will see :
Code: [Select]
delete screen_bufferWhich will call the destructor of your gfx_buffer.

Well, I saw your graphics function and I am understanding that you want to do.
You have to put graphics() and create_gfx_graphics() as static. Otherwise, you will have to do the "new" call.

Why ?
Because you can't use your gfx_buffer, since it needs to be initialized to be used. A static function can be used without initializing (creating) any of the class instance
Otherwise, you can also do the "graphics() function stuff" in the constructor of the class. Which sounds proper


I will stop here for now. Tell me if it is becoming understandable, or not.
Don't hesitate to ask more and more ;)

5
General chat / Re: hello. complete noob here.
« on: July 28, 2014 »
Hello,

Processing is not a bad idea. I am always forgetting such solution (maybe because I prefer to do some low level programming, I don't know).
But, Processing language is specialised in graphical effects. You don't have to bother about low level stuff (pointers, classes or whatever), nor with OpenGL/DirectX or any other library.

So, you shoud take a look.

But, maybe you are a programmer and you like the hard programming stuff. If you want to continue with Java, you should look at LibGDX for 2D struff, and LWGL for 3D stuff (LWGL is a wrapper for OpenGL). If you want to start a new language ... well, you can do that too. My advice will be : take a programming language with which one you are feeling the best. Since graphical programming is a complete area in itself, it's better to use a known language to start :)

6
General chat / Re: A new guy approacheth
« on: October 06, 2012 »
I started by the beginning :)

Ok, it's not that easy, but well, in fact it is :D (fuzzy logic ?)
I mean that, as when you are learning a new programming language, you will start by this "Hello World". Same for demos, you will start with one rotating cubes and then you will try to add cubes, to morph cubes, to change colours and to add lots of polished things and then, it will looks like a real demo similar to the one you loves.
Do you see my point ?
Just go and play around. Take one idea (or one effect) try to reproduce it (we are all starting by reproducing stuff).

Don't forget to read on internet, technical papers, blogs, tutorials related to demoscene or not :)

If I can give you a starting point, you said you made some OpenGL. Did you look at shaders ? Did you learn to use these ? Did  you look at FBO ?
There are the base of 3D applications nowadays.

7
General chat / Re: A new guy approacheth
« on: October 06, 2012 »
Hello,

A demo is just a sequence of effects. So, let's say, you know how to code rotating cube in OpenGL, rotating triangle and some other rotating spheres :D. To make a demo, you have just to find a way to sequence these three effects and you are done (or nearly). To add the final touch, you have to add music (to sync it since it's better) and to add camera moves, respects screen and there you are :)

8
C / C++ /C# / Re: Visual c++ code optimization.
« on: March 21, 2012 »
Hello,

Someone gave me this link -> http://www.catch22.net/tuts/minexe a long time ago ... I hope the article is still in place :s
I guess it is this one -> http://www.catch22.net/tuts/reducing-executable-size

9
C / C++ /C# / Re: problems installing openGL
« on: March 18, 2012 »

10
Hello,

I agree with Jim :)

The solution was something like :
Code: [Select]
Font::print(frase);Since the function is accepting the char* directly. (Previous code was giving just one char to the function).

11
Hello,

Seems nice :)
Why to not post it ? (Personnaly, I am not even using Flickr :D)

12
DirectX is far easier since Microsoft helps its integration (but not for OpenGL).

With GLEW seriously, it becomes really easy (but some people does not like it).
It also exist an kind of same thing that GLEW called GLEE but ... not sure that it is up to date.

The wglGetProcAdress is not that difficult. Use a macro (or other advanced C / C++ technique) and you wil have nice results :p
But better do not reinvent the wheel ... you should use GLEW I think :D

13
Ok ... I see. Bad that you don't speak french, I know a tutoriel "good".

NeHe, is ok, but maybe too old.
Maybe you can check that -> http://www.swiftless.com/opengltuts/opengl4tuts.html
But I am not sure about the quality.

You need OpenGL (normally already on your machine) and GLEW ( if you are with Windows) http://glew.sourceforge.net/
You need GLM if you are doing OpenGL 3.x  http://glm.g-truc.net/ to handle matrices.
You need SDL or other stuff to open the windows (you can use FreeGLUT / WinAPI / Qt / GTK / wxWidget or whatever handling windows as replacement :p ) SDL will help you to load files :)

Ok, It was not so easy :P
If you don't get it ... just try to open an GL window with SDL :)

14
How to apply ?

You have created your texture and shader and now you have the OpenGL ids (similar to pointers).
Since OpenGL is working like a state machine, you have to enable the texture (is called "bind") with glBindTexture().
Same goes for all others OpenGL objects (shaders / buffers ...)

Once is bound, you are using it. For instance, if you order an draw command (glDrawArray) these shader / texture will be used during rendering.

(And then, we have to talk about what is inside the shaders ? )

15
Hello,

Let say, you have picture data (uncompressed) stored in memory.
In OpenGL, you can use glTexImage2D() to pass your data to OpenGL (and like this, having a texture). To pass it, you just use the pointer on the data you have in memory.
For shaders, it the same.
For Shader, you can even write you shader in the code source like this :
Code: [Select]
const char* myPixShader = "int main() { gl_FragColor = vec4(1.0,0.0,0.0,1.0);"
The hardest part, maybe, is "how to load data from a file to memory" :D

16
C / C++ /C# / Re: expert question ;)
« on: March 02, 2012 »
Totally agree with Hellfire.

(Actually I hate these kind of Microsoft's fancy stuff).
The WinMain accept some special Microsoft types (Handle to commande line / parent Window).

17
C / C++ /C# / Re: BoRnTrO - Insolit Dust
« on: February 24, 2012 »
@Kirl : Are you under Linux ?

Otherwise, there is a Win32 (working on Win64 :D) port on Pouet.net :)

18
C / C++ /C# / Re: BoRnTrO - Insolit Dust
« on: February 24, 2012 »
Nice demo. I hope to see more from you :)
I have to check the code :)

Maybe you made an error in the scroller (modaarchive) not sure though

19
General chat / Re: schwerer verkehrsunfall
« on: February 23, 2012 »
My best wishes for your recovery

20
I was with VirtualBox ... ... so the graphic card could have work directly ... (I hate that)

Otherwise, I am wondering on which kernel are they, since ACPI improvement have been done in 3.2 (or something really recent).
So, from your review ... it's a clearly "nothing special" ... some crap packaged in a Linux with new color scheme ...

Pages: [1] 2 3 4 5 6 7 8 ... 20