Author Topic: Tiny, tiny OpenGL window and shader setup code  (Read 19859 times)

0 Members and 1 Guest are viewing this topic.

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #20 on: February 24, 2008 »
Update:
 
I've been working on a 1k recently. To cut a long story short, I managed to get the OGL framework down in size by repeatedly  :whack: myself. The framework does the following:

* Opens a window full screen, any size
* Draws a rectangle to cover the screen
* Creates and tuns a minimal shader
* PASSES a TIMER into the shader
* Handles ESC

In all, using my crinkler and VC++ settings , it clocks in at 821 bytes which levels the playing field between OGL and D3D a bit more (considerably infact). If you want the framework send me a PM.

Taj
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #21 on: February 24, 2008 »
In all, using my crinkler and VC++ settings , it clocks in at 821 bytes which levels the playing field between OGL and D3D a bit more (considerably infact). If you want the framework send me a PM.

Im happy for you big guy. Bet that took a whole lotta head scratchin to do

Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #22 on: February 24, 2008 »
In all, using my crinkler and VC++ settings , it clocks in at 821 bytes which levels the playing field between OGL and D3D a bit more (considerably infact). If you want the framework send me a PM.

Im happy for you big guy. Bet that took a whole lotta head scratchin to do

Well I started work on this 1k in November of last year , so 3 months its taken on and off.
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #23 on: February 25, 2008 »
Update:
 
I've been working on a 1k recently. To cut a long story short, I managed to get the OGL framework down in size by repeatedly  :whack: myself. The framework does the following:

* Opens a window full screen, any size
* Draws a rectangle to cover the screen
* Creates and tuns a minimal shader
* PASSES a TIMER into the shader
* Handles ESC

In all, using my crinkler and VC++ settings , it clocks in at 821 bytes which levels the playing field between OGL and D3D a bit more (considerably infact). If you want the framework send me a PM.

Taj

Great news. Congratulations, taj. Now the war of between OGL/D3D
is open again ;-)
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #24 on: February 29, 2008 »
If you want to see code , its linked off my blog (http://sizecoding.blogspot.com/). Get the code for chocolux and you'll see three new tricks:
1. glRecti passing in time ! This is the big one.
2. #pragmas to assist crinkler (6 bytes saved - your mileage may vary)
3. __forceinline for the shader setup (1 byte - your mileage may vary)

This framwework is even smaller than Iqs :-)
Taj
« Last Edit: February 29, 2008 by taj »
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #25 on: March 01, 2008 »
Wow, the timer using GetTickCount() + glRecti idea is just amazing!
Challenge Trophies Won:

Offline zplex

  • ZX 81
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #26 on: March 11, 2008 »
Hi folks, and thanks for a nice forum. I am trying to compile taj`s code in Visual Studio .Net 2005, but get an "error LNK2001: unresolved external symbol _WinMain@16" File: MSVRCT.lib error message. What can cause this problem, do i need to update the SDK?

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #27 on: March 11, 2008 »
zplex,

no you dont need to. It sounds like you are trying to compile as a console application not a windows application. I'll upload a minimal framework (give me a bit of time) and I hope you can import into VS2006 (I'm using VS Express).

Good to see you here.

Taj
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #28 on: March 11, 2008 »
OK Zplex,

in the archive is a wholly contained VC project with my source for my latest 1k (chocolux). This is a good base which you may strip the shaders out of and replace with your own.

Download the archive and unpack
Then get crinkler from here:http://www.crinkler.net/ (the license of crinkler means I cant include it)
Put crinkler in your project directory but rename it to link.exe
Double click project file (dont try to start a new project yourself)

--- up to here it all works with VC Express (checked)

VC 2006 .NET ... I hope it imports OK.

If not, we'll do it the hard way :-)

Taj
Challenge Trophies Won:

Offline zplex

  • ZX 81
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #29 on: March 11, 2008 »
Thanks man, really fast response :) The only thing that was a little troublesome now was that it didnt recognize the glext.h file in the project. But i just made a copy of it and put it in my C:\Programfiles\Microsoft Visual Studio 8\VC\PlatformSDK\Include\GL folder.

Here is a screenshot of the Visual Studio version i use, never heard about the 2006 version though :/


Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #30 on: March 11, 2008 »
Think I got confused...never mind :-) glad it works. Have fun.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Tiny, tiny OpenGL window and shader setup code
« Reply #31 on: March 11, 2008 »
Thanks Taj!

Jim
Challenge Trophies Won: