9 Replies - 1937 Views - Last Post: 24 April 2011 - 09:06 AM Rate Topic: -----

#1 Gogeta70  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-April 11

Graphics library from scratch

Posted 24 April 2011 - 01:10 AM

Hey everyone ^_^

I'm interested in creating a very simple graphics library. Similar to how opengl and directx work, i suppose. I want to be able to directly output shapes and lines to the screen. I've searched on google and got ambiguous results. The most interesting one was vesa programming using vesa bios extentions, but i've heard that method is outdated.

So, i'm just asking where i should start? What is the best method to achieve this? My guess would be a driver that operates in ring 0...

By the way, i'm wanting to develop this on windows.

Is This A Good Question/Topic? 0
  • +

Replies To: Graphics library from scratch

#2 JaKWaC  Icon User is offline

  • D.I.C Head

Reputation: 76
  • View blog
  • Posts: 234
  • Joined: 15-November 10

Re: Graphics library from scratch

Posted 24 April 2011 - 01:47 AM

From the reading I've done you can't. Its implemented into the OS, companies like Nvidia and ATI (AMD) supply the libraries to use the OpenGL/DirectX standards on their cards.

Maybe I miss understood your question though since you didn't mention anything about graphic cards.

This post has been edited by JaKWaC: 24 April 2011 - 01:48 AM

Was This Post Helpful? 0
  • +
  • -

#3 Gogeta70  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-April 11

Re: Graphics library from scratch

Posted 24 April 2011 - 02:22 AM

Basically, i want to be able to render shapes like you can in opengl and directx. Right now, i just want to start simple with things like 2d shapes and lines. Since i'm on windows i know i could just use GDI, but i've read that graphics libraries store vertex data directly in the graphics card memory to improve performance. I don't know of any way to do this in c++, so i was wondering what the best way to go about this would be.
Was This Post Helpful? 0
  • +
  • -

#4 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5777
  • View blog
  • Posts: 12,591
  • Joined: 16-October 07

Re: Graphics library from scratch

Posted 24 April 2011 - 04:56 AM

On Windows, the best you can get is DirectX. The OS will not let you talk to the hardware directly. Depending on the driver support, you you may be able to talk more directly to the card via raw call. The point of DirectX, or OpenGL, or any abstraction layer, is that the card stuff is handled for you.

For your own library... Well, you just need to plot pixels of a given color; everything after that is bonus. However, home grown routines will never be more efficient than passing the instruction sets down to the card. Or, for that matter, using the library that optimizes the request for the card. There are times you want to move entire buffers around, which is more a hardware trick.
Was This Post Helpful? 0
  • +
  • -

#5 Gogeta70  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-April 11

Re: Graphics library from scratch

Posted 24 April 2011 - 05:01 AM

Well the operating system restricts what you can do with ring 3 applications, but what if i develop a driver that operates at ring 0? It can't be impossible to do this. Opengl isn't owned by microsoft and they're a pretty good graphics library. How did they do it?

This post has been edited by Gogeta70: 24 April 2011 - 05:02 AM

Was This Post Helpful? 0
  • +
  • -

#6 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Graphics library from scratch

Posted 24 April 2011 - 07:25 AM

> Opengl isn't owned by microsoft and they're a pretty good graphics library. How did they do it?

OpenGL isn't a library. It's a standard. Then, various vendors implement that standard. Microsoft implements the software API so developers can use it. Hardware vendors implement the hardware, and then write a driver that works with Windows to support various API calls.
Was This Post Helpful? 0
  • +
  • -

#7 Gogeta70  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-April 11

Re: Graphics library from scratch

Posted 24 April 2011 - 07:33 AM

OpenGL = Open Graphics Library...

Okay, so vendors are implementing opengl into their hardware... Well surely this isn't impossible. What about my ring0 driver idea? Or is that completely off track?

This post has been edited by Gogeta70: 24 April 2011 - 07:41 AM

Was This Post Helpful? 0
  • +
  • -

#8 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5777
  • View blog
  • Posts: 12,591
  • Joined: 16-October 07

Re: Graphics library from scratch

Posted 24 April 2011 - 08:01 AM

It helps to how all the players are lined up. This does a pretty good job of explaining: http://www.opengl.or...ticle/vol003_9/

OpenGL is actually better positioned than I expected, since Vista architecture. Looks like what is now being called the Desktop Window Manager is your lowest point of entry. Write to that and you're on your way.
Was This Post Helpful? 0
  • +
  • -

#9 Aphex19  Icon User is offline

  • Born again Pastafarian.
  • member icon

Reputation: 614
  • View blog
  • Posts: 1,873
  • Joined: 02-August 09

Re: Graphics library from scratch

Posted 24 April 2011 - 08:03 AM

Inside of the Windows operating system you will (usually) have to talk to the kernel, who will in turn talk to the hardware on your behalf. In Windows, to do that you will have to write a driver for your specific hardware, which the kernel will load and use to talk to the hardware, which is certainly not as easy as it sounds.

Alternatively, you may wish instead to write some sort of wrapper for an existing graphics library, or if you're interested, get into OSdev, where you can do what the hell you want with the hardware.
Was This Post Helpful? 1
  • +
  • -

#10 Gogeta70  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 24-April 11

Re: Graphics library from scratch

Posted 24 April 2011 - 09:06 AM

Ah. So i'm basically limited by the operating system. OSdev isn't really what i was looking for, but now that i think of it, it does sound intriguing. I'll look into it. Thanks to everyone for all the information here, it's much appreciated ^_^
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1