12 Replies - 1383 Views - Last Post: 27 September 2020 - 05:00 AM Rate Topic: -----

#1 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

what is the best function for draw texture?

Posted 23 September 2020 - 05:21 AM

now i'm trying learning how draw a texture on a plane.
i know create a plane(3D), my problem, now, is: how can i add a texture to it?
the brush(API) and plgblt() are good, but they don't work on 3D. so what is the best(thinking on API, GDI and GDIPLUS) for draw a texture?
Is This A Good Question/Topic? 0
  • +

Replies To: what is the best function for draw texture?

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7551
  • View blog
  • Posts: 25,407
  • Joined: 05-May 12

Re: what is the best function for draw texture?

Posted 23 September 2020 - 05:31 AM

Unless you use DirectX or OpenGL, you'll have to write your own code that maps the pixels of the texture to a triangle that's been rotated in world space and then mapped to screen space.
Was This Post Helpful? 1
  • +
  • -

#3 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

Re: what is the best function for draw texture?

Posted 23 September 2020 - 05:40 AM

if i create my own, i must use a pixel way and the best is DIB's, right?
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7551
  • View blog
  • Posts: 25,407
  • Joined: 05-May 12

Re: what is the best function for draw texture?

Posted 23 September 2020 - 03:00 PM

See 3D Software Rendering Engine - Part I

He does a some shading and texture mapping using GDI.
Was This Post Helpful? 1
  • +
  • -

#5 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

Re: what is the best function for draw texture?

Posted 24 September 2020 - 01:25 PM

i'm sorry, but it's too much theory for i understand it :(
"Our 3D model is now fully visible. You may ask however what happened with the sides of the cube that are not visible (the back faces). They are not rendered on this scene in order not bring to many details to the viewer, although in the wireframe mode it is normal to have them shown also."
but don't tell us how we calculate what we can show... speak only on 'slope', but i don't understand what is :(
i'm sorry, but can you give me a key words for i search on google and find more about it?
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15927
  • View blog
  • Posts: 63,731
  • Joined: 12-June 08

Re: what is the best function for draw texture?

Posted 24 September 2020 - 01:32 PM

Is there a particular reason you are not utilizing existing solutions for that?
Was This Post Helpful? 1
  • +
  • -

#7 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

Re: what is the best function for draw texture?

Posted 24 September 2020 - 01:41 PM

just for learn more using math and API functions.
correct me anotherthing: if a polygon is drawed using different's Z(on vertices), the brush can fill the triangle correctly(the brush image can be rotated with triangle rotation)?

thinking on pyramid for example
Was This Post Helpful? 0
  • +
  • -

#8 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7551
  • View blog
  • Posts: 25,407
  • Joined: 05-May 12

Re: what is the best function for draw texture?

Posted 24 September 2020 - 05:44 PM

I forgot about GDI+. It's learning curve is not as steep as OpenGL or DirectX, and it had world space to screen viewport transforms as well as texture brushes which respect those transforms.

But of you say you want to learn the maybe behind 3D to 2D rendering, then GDI+ will hide all that from you.
Was This Post Helpful? 1
  • +
  • -

#9 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

Re: what is the best function for draw texture?

Posted 25 September 2020 - 01:25 PM

correct me 1 thing: the GDI\GDIPLUS use GPU or they are different?
to be honest i need use less CPU and draw it by shape form.
Was This Post Helpful? 0
  • +
  • -

#10 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7551
  • View blog
  • Posts: 25,407
  • Joined: 05-May 12

Re: what is the best function for draw texture?

Posted 25 September 2020 - 04:52 PM

See here: Overview of the Windows Graphics Architecture

If you want to use less CPU, avoid GDI and GDI+. Plan on using DirectX, OpenGL, or DirectDraw.
Was This Post Helpful? 1
  • +
  • -

#11 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

Re: what is the best function for draw texture?

Posted 26 September 2020 - 01:27 PM

thank you so much.
let me ask you more 1 thing about the texture: the wall can be a rectangle with Y rotation to zero, but if i draw, without a rotation, a wall with Y =90(like i said without rotation), is possible calculate the Y degree\rotation?
(these calculation is for give me the texture rotation from the original)
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7551
  • View blog
  • Posts: 25,407
  • Joined: 05-May 12

Re: what is the best function for draw texture?

Posted 26 September 2020 - 07:28 PM

I don't understand the question. And how does that relate to your API question?
Was This Post Helpful? 1
  • +
  • -

#13 Cambalinho   User is offline

  • D.I.C Addict

Reputation: 2
  • View blog
  • Posts: 807
  • Joined: 04-March 12

Re: what is the best function for draw texture?

Posted 27 September 2020 - 05:00 AM

is for i see the way that i must draw it.. but i can create a new thread.. is more math
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1