Author Topic: C# - Getting started with graphic functions  (Read 25687 times)

0 Members and 1 Guest are viewing this topic.

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #20 on: June 15, 2012 »
That  CS_GFX_TEST ran so fast on my system and you should put FPS on top left corner on how many frames per seconds is :)

The XNA Tutorials of  putting 2D Sprites is quite good

http://www.xnadevelopment.com/tutorials.shtml
« Last Edit: June 15, 2012 by Hotshot »

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #21 on: June 15, 2012 »
K++ for the explanation, Kirl.

I have attached my first attempt at 3D graphics in C# - it's a port of the same code I used in the Quaternion tutorial, so it's probably more CPU intensive than the equivalent OpenTK / SharpDX equivalent.

Now to switch to one of these API's.

Great stuff CK :)
raizor

Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #22 on: June 16, 2012 »
I'll look up how to add an FPS counter.

I've been experimenting with OpenTK - it seems that some of the commands are slightly different to their OpenGL equivalents, but there's plenty of documentation for both.

The tricky bit now is finding information regarding 3D functions in OpenTK - perhaps I'd best check the OpenGL documentation too.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #23 on: June 16, 2012 »
My Pixel 3D compo entry was written in C# using OpenTK. The source is posted on the board in this post. Might be some use to you CK.
raizor

Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #24 on: June 16, 2012 »
K++, I'll have a look.
You are our 9001st visitor.
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #25 on: June 19, 2012 »
Between everybody's help, I have created a spinning Isocidodecahedron in C# using OpenTK and some ported Quaternion code, though OpenTK probably has its own built in Quat functions.

I've still not put a FPS counter on, but here it is:

Use Escape to quit, arrow keys to move on the X & Y coordinates, and Numpad8 and Numpad2 to move on the Z coordinate.

Next I'll look into texture mapping.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #26 on: June 19, 2012 »
WOW  You make look easy  ;D

Here Exerciser for ya

1) Make it smaller
2)  Chnage the Colours in Red and White
3) move round and if hit on left hand side or right hand side or top or bottom screen then change the value....Hints  DX(Left and right) and DY(Top and bottom)

That should keep ya good coding Exerciser  :)

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #27 on: June 19, 2012 »
Challenge accepted :)

(update)
#1 and #2 are done, just working through the maths for #3.

(update 2)
#3 looks like simple trigonometry - time to make it work :)
« Last Edit: June 20, 2012 by combatking0 »
You are our 9001st visitor.
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #28 on: June 21, 2012 »
Hopefully this meets your specifications - the ball is now smaller, is red & white, and performs a "wrap" when it goes off the top, bottom, left or right of the drawing area.

I have also improved the controls a little - before, only 1 key could be used at a time. Now you can use as many keys as you want, and the motion is smoother.

The controls are now -
Left & Right - X Position
Up & Down - Y Position
W & S - Z Position
« Last Edit: June 21, 2012 by combatking0 »
You are our 9001st visitor.
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #29 on: June 23, 2012 »
I've been experimenting with using 2 separate textures (a red one and a white one), but it seems to always use the last texture which was defined.

Apparently, this is a common issue for beginners, so I'll look into a fix for it tomorrow, followed by how to apply light sourcing. It should then start to look like some of the better 3D demos seen round here.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #30 on: June 23, 2012 »
I've been experimenting with using 2 separate textures (a red one and a white one), but it seems to always use the last texture which was defined.

Apparently, this is a common issue for beginners, so I'll look into a fix for it tomorrow, followed by how to apply light sourcing. It should then start to look like some of the better 3D demos seen round here.

Normally, when you create a texture it gives you a texture ID relating to the new texture. You then bind a particular texture ID when you want to use it. I take it this is OpenTK stuff?
raizor

Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #31 on: June 24, 2012 »
Yes, it's OpenTK.

I've worked it out - I was trying to use the same bitmap object to store 2 textures (which is very silly, looking back), and trying to use 2 textures during one GL.Begin session (which wasn't as obvious, but I'll get used to it). I have attached the results below.

I'll next learn how to apply light sourcing to a texture.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #32 on: June 24, 2012 »
Quote
Hopefully this meets your specifications - the ball is now smaller, is red & white, and performs a "wrap" when it goes off the top, bottom, left or right of the drawing area.

I have also improved the controls a little - before, only 1 key could be used at a time. Now you can use as many keys as you want, and the motion is smoother.

The controls are now -
Left & Right - X Position
Up & Down - Y Position
W & S - Z Position

Excellent Man....You could make own Asteroid Clone Game and go on...you can do it  :clap:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #33 on: June 24, 2012 »
I could make it a bit like Asteroids, but in 3D - cool idea!

I might change the name though, to avoid copyright infringement.
You are our 9001st visitor.
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #34 on: June 25, 2012 »
I've managed to get the light sourcing working, but the effect seems to work best if the position of the light source is moving.

When I tidy up my code, I'll make a tutorial.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #35 on: June 27, 2012 »
Look good......

You have learn how to make

ploygen( I think)
Texture them
Put light on them

You are progressing  :)

Tutorials would be nice on how you made it together :)
« Last Edit: June 27, 2012 by Hotshot »

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: C# - Getting started with graphic functions
« Reply #36 on: June 27, 2012 »
It crashes for me on win7.  :-\
www.kirl.nl
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: C# - Getting started with graphic functions
« Reply #37 on: June 27, 2012 »
The code is a bit of a mess, but it runs OK on XP - I'm not sure what could be causing the crashes. Does it run for a short time?
You are our 9001st visitor.
Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: C# - Getting started with graphic functions
« Reply #38 on: June 27, 2012 »
It thinks for a bit and then it says it isn't responding, it gives me the option to look for a solution online or to close the program.
I copied the details of the crash but it's in dutch, not sure if it's of any use.

Code: [Select]
Probleemhandtekening:
  Gebeurtenisnaam van probleem: CLR20r3
  Probleemhandtekening 01: gametest.exe
  Probleemhandtekening 02: 1.0.4559.38359
  Probleemhandtekening 03: 4fe8d5af
  Probleemhandtekening 04: GameTest
  Probleemhandtekening 05: 1.0.4559.38359
  Probleemhandtekening 06: 4fe8d5af
  Probleemhandtekening 07: 1
  Probleemhandtekening 08: 40c
  Probleemhandtekening 09: System.IO.FileNotFoundException
  Versie van besturingssysteem: 6.1.7601.2.1.0.768.3
  Landinstelling-id: 1043
  Aanvullende informatie 1: 0a9e
  Aanvullende informatie 2: 0a9e372d3b4ad19135b953a78882e789
  Aanvullende informatie 3: 0a9e
  Aanvullende informatie 4: 0a9e372d3b4ad19135b953a78882e789
www.kirl.nl
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: C# - Getting started with graphic functions
« Reply #39 on: June 27, 2012 »
You forgot add OpenTK.dll and OpenTK.GLControl.dll to make it work as without these files then of course it would crash

Here the files with OpenTK.dll and OpenTK.GLControl.dll and it work  ;D
« Last Edit: June 27, 2012 by Hotshot »