I have a problem, i was watching you're videos (Beginner C++ DirectX Game Programming Tutorial: Lesson 4) and an error came up i am sending the program so you can tell me whats wrong.
sincerely Henrik
(sorry for my bad English but I am 14 and live in Denmark )
Hello Chillie
-
- Posts: 4
- Joined: May 19th, 2012, 4:37 pm
Re: Hello Chillie
Here it is:
{
int x;
int y;
x=0;
y=0;
gfx.PutPixel( x, y,255,255,255);
gfx.PutPixel( -5 + x, y,255,255,255);
gfx.PutPixel( -4 + x, y,255,255,255);
gfx.PutPixel( -3 + x, y,255,255,255);
gfx.PutPixel( 3 + x, y,255,255,255);
gfx.PutPixel( 4 + x, y,255,255,255);
gfx.PutPixel( 5 + x, y,255,255,255);
gfx.PutPixel( x, -5 + y,255,255,255);
gfx.PutPixel( x, -4 + y,255,255,255);
gfx.PutPixel( x, -3 + y,255,255,255);
gfx.PutPixel( x, 3 + y,255,255,255);
gfx.PutPixel( x, 4 + y,255,255,255);
gfx.PutPixel( x, 5 + y,255,255,255);
}
{
int x;
int y;
x=0;
y=0;
gfx.PutPixel( x, y,255,255,255);
gfx.PutPixel( -5 + x, y,255,255,255);
gfx.PutPixel( -4 + x, y,255,255,255);
gfx.PutPixel( -3 + x, y,255,255,255);
gfx.PutPixel( 3 + x, y,255,255,255);
gfx.PutPixel( 4 + x, y,255,255,255);
gfx.PutPixel( 5 + x, y,255,255,255);
gfx.PutPixel( x, -5 + y,255,255,255);
gfx.PutPixel( x, -4 + y,255,255,255);
gfx.PutPixel( x, -3 + y,255,255,255);
gfx.PutPixel( x, 3 + y,255,255,255);
gfx.PutPixel( x, 4 + y,255,255,255);
gfx.PutPixel( x, 5 + y,255,255,255);
}
-
- Posts: 4
- Joined: May 19th, 2012, 4:37 pm
Re: Hello Chillie
But it say hvem i start the program:
Assertion failed!
program:...
File c:\user\henrik\desktop\c++programming (thats what my folder)\d3dgraphics.cpp
line: 71
Expression
For information on how your program can cause an assertion failure, see the C++ documentation on asserts
(Press retry to debug the application - JIT must be enabled)
Assertion failed!
program:...
File c:\user\henrik\desktop\c++programming (thats what my folder)\d3dgraphics.cpp
line: 71
Expression
For information on how your program can cause an assertion failure, see the C++ documentation on asserts
(Press retry to debug the application - JIT must be enabled)
- accucore12
- Posts: 14
- Joined: May 18th, 2012, 1:06 pm
Re: Hello Chillie
Hi. It has got to do with the parameters passed to PutPixel function
For instance in this line of your code,
gfx.PutPixel( -5 + x, y,255,255,255);
Notice that when x is 0.
-5 + x evaluates to negative 5 which does not fall within 0 to 800.
So It terminates with an error since there is no location on your screen that has coordinate of -5.
One thing to keep in mind when following the tutorial is that the X values has to be within 0 to 800
Y value has to be within 0 to 600.
An example of fixing this would be the below(make sure you understand the underlying reason is that i am trying to remove any occurence of negative coordinate)
instead of
x=0;
y=0;
replace it with
x=100;
y=100;
I hope this would be of help to you.
For instance in this line of your code,
gfx.PutPixel( -5 + x, y,255,255,255);
Notice that when x is 0.
-5 + x evaluates to negative 5 which does not fall within 0 to 800.
So It terminates with an error since there is no location on your screen that has coordinate of -5.
One thing to keep in mind when following the tutorial is that the X values has to be within 0 to 800
Y value has to be within 0 to 600.
An example of fixing this would be the below(make sure you understand the underlying reason is that i am trying to remove any occurence of negative coordinate)
instead of
x=0;
y=0;
replace it with
x=100;
y=100;
I hope this would be of help to you.
Code: Select all
Occupation: Reverse Engineer
-
- Posts: 4
- Joined: May 19th, 2012, 4:37 pm
Re: Hello Chillie
Dude you're fu****g awesome thanks
Re: Hello Chillie
I second that emotion.coolhenrik10 wrote:Dude you're fu****g awesome thanks
Chili