Author Topic: oldschool 2d and opengl  (Read 22788 times)

0 Members and 1 Guest are viewing this topic.

Offline hellsangel

  • C= 64
  • **
  • Posts: 46
  • Karma: 10
    • View Profile
oldschool 2d and opengl
« on: August 06, 2007 »
hi

I like opengl, and I understand the 3D part, and even how to make a 2d like-scene.
but I don't understand how to make the old Amiga copper/blitter effects  ;D
Gradient rasters, plasma...and texts effects (hmm like keops/Equinox intros)
I've done a simple scrolltext (vertical and horizontal - the opengl coordinates and scales are difficults to use  :o )
but how to done a Sinus scrolltext for example?!? or a copper "twister" scrolltext, roller scroll, and many others good old effects !  :-[

I've already done many of these effects with sdl or ptc,... but my problem is to understand how to convert these kinds of effects with a 3D engine  ::)  :crutches:

if someone have any experiences with OpenGl, I hope he can make some examples, tutorials, ...
share and enjoy
perhaps I'll could done some new oldschoolish intros one day...in the future  ;)
thanks
« Last Edit: August 06, 2007 by [Y] »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: oldschool 2d and opengl
« Reply #1 on: August 06, 2007 »
I too am in the same situation as you.

I guess that a lot of it would be possible using quads, things such as sine scrollers etc.

I hope that you get some good answers to this because I'll be watching this topic too.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #2 on: August 07, 2007 »
Quote
the opengl coordinates and scales are difficults to use
Normally what I do with OpenGL is to stick it in orthographic mode - that is, no perspective calculation, it just takes the X and Y of anything you draw and throws away the Z value.  That makes the coordinates really easy to use as they're just 2d screen coordinates.
The basic code for that is
Code: [Select]
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, (GLdouble)SCREEN_WIDTH, (GLdouble)SCREEN_HEIGHT, 0.0, 0.0, 1.0);

The other thing you can use which is simpler than using quads and textures is glDrawImage.  It can be very slow if you use it a lot, but for drawing a couple of sprites it's pretty useful.  The biggest problem is it draws upside down unless you call
Code: [Select]
glPixelZoom(1.0, -1.0);
which flips the y-axis.

I guess the first step you want to take is code to draw
a) filled solid rectangles
b) gradient solid rectangles
c) filled textured rectangles
d) gradient textured rectangles

Most old demos have to use just these things because that's all the hardware can do.
A solid rectangle is simply
Code: [Select]
glBegin(GL_QUADS);
glColor3f(r,g,b);
glVertex2i(x0,y0);
glVertex2i(x1,y1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glEnd();

A 2d gradient rectangle is
Code: [Select]
glBegin(GL_QUADS);
glColor3f(r0,g0,b0);
glVertex2i(x0,y0);
glVertex2i(x1,y1);
glColor3f(r1,g1,b1);
glVertex2i(x2,y2);
glVertex2i(x3,y3);
glEnd();

A gradient rectangle with 4 different coloured corners is
Code: [Select]
glBegin(GL_QUADS);
glColor3f(r0,g0,b0);
glVertex2i(x0,y0);
glColor3f(r1,g1,b1);
glVertex2i(x1,y1);
glColor3f(r2,g2,b2);
glVertex2i(x2,y2);
glColor3f(r3,g3,b3);
glVertex2i(x3,y3);
glEnd();

In all those snips, r,g,b are 0.0 to 1.0 and x,y are in screen coordinates once you've set the view up like in the first snippet.

Have fun!

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: oldschool 2d and opengl
« Reply #3 on: August 07, 2007 »
Bloody hell Jim how do you find the time!

 :goodpost: karma++



Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: oldschool 2d and opengl
« Reply #4 on: August 07, 2007 »
Jim is a guru, if he doesn't know it it's not worth knowing.  :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: oldschool 2d and opengl
« Reply #5 on: August 07, 2007 »
Jim is a guru, if he doesn't know it it's not worth knowing.  :)

lol ... so true ;-) Jim rules.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline hellsangel

  • C= 64
  • **
  • Posts: 46
  • Karma: 10
    • View Profile
Re: oldschool 2d and opengl
« Reply #6 on: August 07, 2007 »
wow! quick !
thanks a lot  :cheers:
good starting. I've no time atm, but I'll try asap
I've found how to display some dots to make a starfield and even a "raster" bar
I think now the next step is how to change the gradient to make gradient lines or a plasma ;)

I've also seen on the forum a subject about a 2d intro on a dynamic opengl texture, but I can't find the post (perhaps in freebasic)

more to come I hope  :)

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: oldschool 2d and opengl
« Reply #7 on: August 07, 2007 »
...
I've found how to display some dots to make a starfield and even a "raster" bar
...

Feel free to post your sources / steps here. Guess a lot of ppl would be glad to
learn from them  :buddies:
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #8 on: August 12, 2007 »
Here's a demo framework for trying out this kind of stuff with OpenGL.  You can plug your own code in inside the ogl_draw() function - for example, the little snippets I posted can go in here.  Right now it just draws a 10x10 red quad in the top left of the screen.  Of course the code is nowhere near as small as the 1Kb OpenGL framework - the idea here is that this is about the minimum neat-and-tidy framework you need to form a fully compliant Windows OpenGL application.  I'm going to use it for bug reporting Vista driver problems to ATI and nVidia.

If you need project files, let me know.

Have fun!

Code: [Select]
//-----------------------------------------------------------------------------------------------------------------
//
// Copyright 2007 Jim Shaw.  All Rights Reserved.
//
//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

#include <stdio.h>

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
#define SCREEN_WIDTH  640
#define SCREEN_HEIGHT 480

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
typedef void (APIENTRY *PFNWGLEXTSWAPCONTROLPROC)(int);
static PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL;

static HWND gameWindow;
static HGLRC gameRC;

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
static int ogl_init(void)
{
PIXELFORMATDESCRIPTOR pixeldesc;
int pixelformat;
HDC hDC;

hDC = GetDC(gameWindow);

memset(&pixeldesc, 0, sizeof pixeldesc);
pixeldesc.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pixeldesc.nVersion = 1;

pixeldesc.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pixeldesc.iPixelType = PFD_TYPE_RGBA;
pixeldesc.cColorBits = 32;

pixeldesc.cRedBits = 0;
pixeldesc.cGreenBits = 0;
pixeldesc.cBlueBits = 0;
pixeldesc.cAlphaBits = pixeldesc.cAlphaShift = 0;
pixeldesc.cAccumBits = 32;
pixeldesc.cAccumRedBits =
pixeldesc.cAccumGreenBits = pixeldesc.cAccumBlueBits = 0;
pixeldesc.cAccumAlphaBits = 0;

pixeldesc.cDepthBits = 32;

pixeldesc.cStencilBits = 0;
pixeldesc.cAuxBuffers = 0;

pixeldesc.bReserved = 0;
pixeldesc.dwLayerMask = 0;
pixeldesc.dwVisibleMask = 0;
pixeldesc.dwDamageMask = 0;

if ((pixelformat = ChoosePixelFormat(hDC, &pixeldesc)) == 0)
return 0;

if (pixeldesc.dwFlags & PFD_NEED_PALETTE)
return 0;

if (SetPixelFormat(hDC, pixelformat, &pixeldesc) == FALSE)
return 0;

DescribePixelFormat(hDC, pixelformat, sizeof pixeldesc, &pixeldesc);

    gameRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC, gameRC);

ReleaseDC(gameWindow, hDC);

glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

glDepthRange(0.0, 1.0);
glClearDepth(1.0);
glClearColor(0.5,0.5,0,1.0);
glShadeModel(GL_SMOOTH);

glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);

glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glFrontFace(GL_CCW);

glDisable(GL_LIGHTING);

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

glPixelZoom(1.0, -1.0);

glEnable(GL_TEXTURE_2D);

if (strstr((const char *)glGetString(GL_EXTENSIONS), "WGL_EXT_swap_control"))
{
wglSwapIntervalEXT = (PFNWGLEXTSWAPCONTROLPROC)wglGetProcAddress("wglSwapIntervalEXT");
if (wglSwapIntervalEXT)
wglSwapIntervalEXT(1);
}

return 1;
}

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
static void ogl_shutdown(void)
{
wglMakeCurrent(NULL, NULL);

if (gameRC)
{
wglDeleteContext(gameRC);
gameRC = 0;
}
}

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
void ogl_flip(void)
{
HDC dc;
GLenum err;

err = glGetError();
if (err != GL_NO_ERROR)
{
char tmp[256];
sprintf(tmp, "GLERROR %08X %d\n", err, err);
OutputDebugString(tmp);
}

dc = GetDC(gameWindow);
SwapBuffers(dc);
ReleaseDC(gameWindow, dc);
}

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
void ogl_draw(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

//hud
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0.0, (GLdouble)SCREEN_WIDTH, (GLdouble)SCREEN_HEIGHT, 0.0, 0.0, 1.0);
glViewport(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);

glColor3ub(0xff,0,0);
glBegin(GL_QUADS);
glVertex2f(0,0);
glVertex2f(10,0);
glVertex2f(10,10);
glVertex2f(0,10);
glEnd();
}


//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg )
{
case WM_KEYDOWN:
switch (wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;

case WM_ERASEBKGND:
return 1;

case WM_CLOSE:
case WM_DESTROY:
PostQuitMessage(0);
break;

default:
return DefWindowProc(hwnd, msg, wParam, lParam);
break;
}

return 0;
}

//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------------------------------------------
static char GLSampleClass[32] = "GLSampleClass";

int WINAPI WinMain(HINSTANCE this_inst, HINSTANCE prev_inst, LPSTR cmdline, int cmdshow)
{
WNDCLASS wc;
int style, exstyle;
int quit;
RECT rect;

wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = this_inst;
wc.hIcon = LoadIcon(NULL, (LPCSTR)IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = 0;
wc.lpszMenuName = NULL;
wc.lpszClassName = GLSampleClass;
RegisterClass(&wc);

style = WS_OVERLAPPED|WS_SYSMENU|WS_CAPTION;
exstyle = WS_EX_APPWINDOW;
gameWindow = CreateWindowEx(
0,
GLSampleClass, // class
"OpenGL Sample",
style,
CW_USEDEFAULT,CW_USEDEFAULT, // init. x,y pos
SCREEN_WIDTH,SCREEN_HEIGHT,
NULL, // parent window
NULL, // menu handle
this_inst, // program handle
NULL // create parms
);

GetWindowRect(gameWindow, &rect);
AdjustWindowRectEx(&rect, style, FALSE, exstyle);
SetWindowPos(gameWindow, NULL, 0,0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE);

ShowWindow(gameWindow, cmdshow);
UpdateWindow(gameWindow);

if (ogl_init() == 0)
{
MessageBox(gameWindow, "Failed Initialising OpenGL", "Failed", MB_OK);
return 0;
}

quit = 0;
do
{
MSG msg;
while (PeekMessage(&msg,NULL,0,0, PM_NOREMOVE))
{
if (GetMessage(&msg,NULL,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
quit = 1;
break;
}
}

ogl_draw();
ogl_flip();

} while (!quit);

ogl_shutdown();

return 0;
}

Jim
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #9 on: August 12, 2007 »
Here's the code to do 3 copper bars using the framework (EXE attached)
I've done a shaded version, the one with solid bars is commented out.
I'm using the colour blending function to make the bars' colours add to each other, just like they would if you were using the copperlist to do the effect.
Code: [Select]
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
This tells OpenGL to use
new destination colour = 1 x source colour + 1 x destination colour

Code: [Select]
//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
#define BAR_HEIGHT 80

void ogl_draw(void)
{
static int ry,gy,by;
static int ri=1, gi=2, bi=3;

glClearColor(0,0,0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

//hud
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0.0, (GLdouble)SCREEN_WIDTH, (GLdouble)SCREEN_HEIGHT, 0.0, 0.0, 1.0);
glViewport(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);

glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);

glColor3ub(0,0,0);
glBegin(GL_QUAD_STRIP);
glVertex2i(0,ry);
glVertex2i(SCREEN_WIDTH,ry);
glColor3ub(0xff,0,0);
glVertex2i(0,ry+BAR_HEIGHT/2);
glVertex2i(SCREEN_WIDTH,ry+BAR_HEIGHT/2);
glColor3ub(0,0,0);
glVertex2i(0,ry+BAR_HEIGHT);
glVertex2i(SCREEN_WIDTH,ry+BAR_HEIGHT);
glEnd();

glColor3ub(0,0,0);
glBegin(GL_QUAD_STRIP);
glVertex2i(0,gy);
glVertex2i(SCREEN_WIDTH,gy);
glColor3ub(0,0xff,0);
glVertex2i(0,gy+BAR_HEIGHT/2);
glVertex2i(SCREEN_WIDTH,gy+BAR_HEIGHT/2);
glColor3ub(0,0,0);
glVertex2i(0,gy+BAR_HEIGHT);
glVertex2i(SCREEN_WIDTH,gy+BAR_HEIGHT);
glEnd();

glColor3ub(0,0,0);
glBegin(GL_QUAD_STRIP);
glVertex2i(0,by);
glVertex2i(SCREEN_WIDTH,by);
glColor3ub(0,0,0xff);
glVertex2i(0,by+BAR_HEIGHT/2);
glVertex2i(SCREEN_WIDTH,by+BAR_HEIGHT/2);
glColor3ub(0,0,0);
glVertex2i(0,by+BAR_HEIGHT);
glVertex2i(SCREEN_WIDTH,by+BAR_HEIGHT);
glEnd();
/*
glColor3ub(0xff,0,0);
glBegin(GL_QUADS);
glVertex2i(0,ry);
glVertex2i(SCREEN_WIDTH,ry);
glVertex2i(SCREEN_WIDTH,ry+BAR_HEIGHT);
glVertex2i(0,ry+BAR_HEIGHT);
glEnd();

glColor3ub(0,0xff,0);
glBegin(GL_QUADS);
glVertex2i(0,gy);
glVertex2i(SCREEN_WIDTH,gy);
glVertex2i(SCREEN_WIDTH,gy+BAR_HEIGHT);
glVertex2i(0,gy+BAR_HEIGHT);
glEnd();

glColor3ub(0,0,0xff);
glBegin(GL_QUADS);
glVertex2i(0,by);
glVertex2i(SCREEN_WIDTH,by);
glVertex2i(SCREEN_WIDTH,by+BAR_HEIGHT);
glVertex2i(0,by+BAR_HEIGHT);
glEnd();
*/
ry += ri;
gy += gi;
by += bi;
if (ry < 0) ry = 0, ri=-ri;
else if (ry >= SCREEN_HEIGHT-BAR_HEIGHT) ry = SCREEN_HEIGHT-BAR_HEIGHT-1, ri=-ri;
if (gy < 0) gy = 0, gi=-gi;
else if (gy >= SCREEN_HEIGHT-BAR_HEIGHT) gy = SCREEN_HEIGHT-BAR_HEIGHT-1, gi=-gi;
if (by < 0) by = 0, bi=-bi;
else if (by >= SCREEN_HEIGHT-BAR_HEIGHT) by = SCREEN_HEIGHT-BAR_HEIGHT-1, bi=-bi;
}
Challenge Trophies Won:

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Re: oldschool 2d and opengl
« Reply #10 on: August 12, 2007 »
Hey jim! I tried running your code but I think I have to put something in the linker like: -gl
or something.

At the moment I get these error messages:
Code: [Select]
main.cpp In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
main.cpp redefinition of `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)'
main.cpp `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)' previously defined here
Makefile.win [Build Error]  [main.o] Error 1

Sorry this all probably sounds kind of dumb, but I havent used openGL yet.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #11 on: August 12, 2007 »
You definitely need to have -lgl in there to make sure the OpenGL library is linked in.
First, try renaming the file to .c - it's not c++.

The error is odd, though, it's complaining that there are 2 WinMain functions defined.  Have you left the framework source file devc creates in the project (I'm assuming you're on devc?)

Jim
Challenge Trophies Won:

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Re: oldschool 2d and opengl
« Reply #12 on: August 12, 2007 »
Quote
The error is odd, though, it's complaining that there are 2 WinMain functions defined.  Have you left the framework source file devc creates in the project (I'm assuming you're on devc?)
Yeah I pasted it over the default main that DevC++ generates, but maybe I dident copy over it, just infront of it or something.

Anyway I did what you said, now I get a message saying can't find -lgl . I guess I need the development libraries or something. But its strange as DevC++ comes with the GL header files in its include folder.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #13 on: August 12, 2007 »
Quote
Yeah I pasted it over the default main that DevC++ generates, but maybe I dident copy over it, just infront of it or something.
That sounds very likely.

I can't remember how you specify an extra library in devc.  -lgl is what I would use if I was calling the compiler by hand.  It definitely comes as standard with OpenGL libraries.  The file will be called libgl.a or libopengl.a or libopengl32.a.

Jim
Challenge Trophies Won:

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Re: oldschool 2d and opengl
« Reply #14 on: August 12, 2007 »
Maybe I got to put three or four things into the linker, thats what I have to do with SDL. Anyway its 3 am where I'm at, so I think I'm gong to have to get some sleep now, but I reckon I should be able to find out how to get this running tomorrow. Cheers dude :)

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #15 on: August 12, 2007 »
Project->Project Options->Parameters tab
Click 'Add Library or Object'.
Browse to c:\Dev-CPP\lib\libopengl32.a

That should do it.

Jim

Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: oldschool 2d and opengl
« Reply #16 on: August 12, 2007 »
I'm having a similar problem in VC, getting a load of errors like:

main.obj : error LNK2019: unresolved external symbol __imp__glGetError@0 referenced in function _ogl_flip

Any idea what I'm missing?

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #17 on: August 12, 2007 »
Project->Properties->Linker->Input->Additional Dependencies.
Add 'opengl32.lib'

Jim
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: oldschool 2d and opengl
« Reply #18 on: August 12, 2007 »
Thanks Jim, I was trying that but typing the wrong thing in there. Now i get this:

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
E:\My_Folders\Projects\cpp\vcpp\ogldemo\Debug\ogldemo.exe : fatal error LNK1120: 1 unresolved externals

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: oldschool 2d and opengl
« Reply #19 on: August 12, 2007 »
It's a Windows project, not a console application, so it's looking for main() instead of WinMain().
Project->Properties->Linker->System->SubSystem
change it to 'Windows'.

You'll probably also need to change
Project->Properties->Configuration Properties->General->Character Set
change it to 'Use Multi-Byte Character Set'.

Jim
« Last Edit: August 12, 2007 by Jim »
Challenge Trophies Won: