Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Nov 2009
Offline Last Active May 25 2016 03:45 PM

Posts I've Made

In Topic: Spritebatch With SharpDx

28 October 2014 - 06:47 AM

You forgot to bind a render target:



Thanks, But still no dice sad.png


Also, When i try:


graphics.Clear(new Color4(1, 0, 0, 0));
instead of using the context, it says i'm missing a "presenter"

Could it be when i initialized the sprite batch and passed the device without a presenter its causing the problem?

In Topic: Starting as a game programmer

26 October 2014 - 12:53 PM

I just want some advice from all of the experience game developer here.


Do all of you guys feel like you have to learn c++ in order to learn game programming?


I know there's c# but what bothers me is that most game tutorials were written in c++. You can program OpenGL in c++.


C++ is very ugly it think. You will burn out before you even finished all the definition of the function you have just declared. But i feel like i have to learn it. Maybe because I just want to someday get in video game industry and that its something I have to learn yet part of me is telling do i really need to go through this just to make a game? a 2d game since i am just starting out.


C# is elegant. But i feel like when Im going to c# route I feel like Im missing something. Maybe I was worried about the performance issue because of GC




I really need to get started. Start coding but I cant decide. Some part of me wants c++ another is c#. I dont know.


How about you guys. What kind of experiences have you encountered when you are starting out? what kind of decision did u face? Have you face this kind of issue before?

Im not talking about game engines here.. Just asking what are your experiences.


This is not  technical question but I hope you guys can share some of your experiences you had or can give me advice.







My first post as "advice" so take it as a grain of salt..

Been studying programming for 2 years, Ive "Learned" (although you never stop learning)' C#, Java, Objective-C among other things.. and ive self taught C++

The theory doesn't change: Inheritance, polymorphism, ect just the implementation does. So jump into a language you are most comfortable with because those skills you learn will be portable.


I am personally a fan of C# and although not a recent article C# can get apparently pretty close in DX vs c++.



In Topic: Spritebatch With SharpDx

26 October 2014 - 05:26 AM

It looks like you're not specifying a Viewport to the device context. Aside from needing to define a viewport, SpriteBatch will internally use that to create a projection matrix as input for the sprite shader.


Sorry for the late reply, 


Still can't seem to get it to work, I have tried the following line of code:

context.Rasterizer.SetViewport(0.0f, 0.0f, 512.0f, 512.0f);

But that seems to make no difference.


I mainly only use xna for my 2d games and only dabble in Dx and Opengl.. so any help or links to tutorials to get this working would be a great help.



In Topic: Pointer, array and struct problem?..

10 February 2014 - 07:57 PM

Sorry, i did not compile the code before posting, just replace "pVerticies[i]->" by "pVerticies[i]." and it should compile. Also, remove the "..." in main too, of course smile.png


Are you compiling in c++ or c?


Using c++ and gcc, It works and compiles now. Thanks a bunch 


After actually reading and understanding the code(learnt some new tricks), it wasn't quite what i was after i was hoping to define a triangle with 3 vertices and a color.

and use an iteration for loop to make more triangles, not make a triangle out of an iteration of vertices like you posted smile.png


Something like this maybe:

for (int i = 1; i < 6; i++)
         //Orthographic triangle
	 {0xFF0000FF, -0.0f*i, -0.0f*i, 0.0f}, 
	 {0xffffff00, 0.0f*i, 50.0f*i, 0.0f}, 
         {0xFF00FF00, 50.0f*i, 0.0f*i, 0.0f}, 

If you have time to offer some more assistance that would be excellent, if not thanks again smile.png

In Topic: Pointer, array and struct problem?..

10 February 2014 - 06:41 PM


Your for loop only execute once... so you're effectively assigning to vertices[0] 3 times.

struct Vertex
   unsigned int color;
   float x, y, z;

Vertex vertices[3]; 
Vertex *pVerticies = &vertices[0];

float xVal[3] = {0.0f, 0.0f, 50.0f};
float yVal[3] = {0.0f, 50.0f, 0.0f};
float zVal[3] = {0.0f, 0.0f, 0.0f};

void BuildVerts(Vertex *pVerticies, int NumVerts)
	int i;
	for (i = 0; i < NumVerts; i++)
		pVerticies[i]->color = 0xFF0000FF;
		pVerticies[i]->x = xVal[i];
		pVerticies[i]->y = yVal[i];
		pVerticies[i]->z = zVal[i];

int main(int argc, char* argv[])
    BuildVerts(pVerticies, 3);

I removed the useless structs statements, fixed the loop counter and the pointers array indexes. I dont really like this code(by that i just mean it would be better to load the vertices from a file) but for a simple test it's perfectly fine. I noticed i should have used your Vertex structure to hard code the vertice but this work too.


EDIT: damn... ninja'ed! smile.png


EDIT2: That line

Vertex *pVerticies = &vertices[0];

is totally useless. Try this instead:

    BuildVerts(&vertices[0], 3);



Thanks for your reply!, Going through your code now. Getting some build errors atm.


"error : expected '=', ',', ';', 'asm' or '__attribute__' before 'vertices' "?

Edit: fixed the error by putting back in the "struct" - program now compiles and draws a single vertical line down the screen lol.




Question: Curious about the theory you used to here, They are defined as type INT, but the member uses a float arguement? - 

int xVal[3] = {0.0f, 0.0f, 50.0f};
int yVal[3] = {0.0f, 50.0f, 50.0f};
int zVal[3] = {0.0f, 0.0f, 50.0f};