Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: hellsangel 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
-
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.
-
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
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
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
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
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
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
-
Bloody hell Jim how do you find the time!
:goodpost: karma++
-
Jim is a guru, if he doesn't know it it's not worth knowing. :)
-
Jim is a guru, if he doesn't know it it's not worth knowing. :)
lol ... so true ;-) Jim rules.
-
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 :)
-
...
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:
-
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!
//-----------------------------------------------------------------------------------------------------------------
//
// 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
-
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.
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
This tells OpenGL to use
new destination colour = 1 x source colour + 1 x destination colour
//-----------------------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------------------
#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;
}
-
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:
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.
-
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
-
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.
-
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
-
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 :)
-
Project->Project Options->Parameters tab
Click 'Add Library or Object'.
Browse to c:\Dev-CPP\lib\libopengl32.a
That should do it.
Jim
-
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?
-
Project->Properties->Linker->Input->Additional Dependencies.
Add 'opengl32.lib'
Jim
-
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
-
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
-
Thanks Jim, seems to be working now but I had to put this at the start of the code:
#include "stdafx.h"
-
Project->Properties->C/C++/Precompiled Headers
change to 'Not Using Precompiled Headers'
:)
Basically, that's an compiler speed optimisation that prevents it having to recompile the headers every time you do a build (since they don't change). Can be useful for big projects that take a long time to build.
Glad it's working.
Jim
-
Ah right, thanks again k++
-
:clap:
thank you Jim for the framework and this wonderful RGB copperbars example :cheers:
work perfectly for me
keep up good examples and tuts ;D
:cheers:
-
No problem :kewl:
Is this what you were looking for? Are you interested in any particular old school effect?
Jim
-
I wanted to test my raster routine, but I didn't write it with ortho mode and nothing appears on the screen
Raster[j].y = (GLfloat)sin(Raster[j].angle * 3.1415f / 180) + (Raster[j].height / 2);
glBegin(GL_QUADS);
for(i=0; i<Raster[j].height; i++)
{
glColor3f(Raster[j].col1.r, Raster[j].col1.g, Raster[j].col1.b);
glVertex2f(-1.0f, Raster[j].y);
glColor3f(Raster[j].col2.r, Raster[j].col2.g, Raster[j].col2.b);
glVertex2f(-1.0f, Raster[j].y - (Raster[j].height / 2));
glColor3f(Raster[j].col2.r, Raster[j].col2.g, Raster[j].col2.b);
glVertex2f(1.0f, Raster[j].y - (Raster[j].height / 2));
glColor3f(Raster[j].col1.r, Raster[j].col1.g, Raster[j].col1.b);
glVertex2f(1.0f, Raster[j].y);
glColor3f(Raster[j].col2.r, Raster[j].col2.g, Raster[j].col2.b);
glVertex2f(-1.0f, Raster[j].y - (Raster[j].height / 2));
glColor3f(Raster[j].col3.r, Raster[j].col3.g, Raster[j].col3.b);
glVertex2f(-1.0f, Raster[j].y - Raster[j].height);
glColor3f(Raster[j].col3.r, Raster[j].col3.g, Raster[j].col3.b);
glVertex2f(1.0f, Raster[j].y - Raster[j].height);
glColor3f(Raster[j].col2.r, Raster[j].col2.g, Raster[j].col2.b);
glVertex2f(1.0f, Raster[j].y - (Raster[j].height / 2));
}
glEnd();
...
something wrong with old coord and ortho mode
or is it possible to mix 2D and 3D in a same drawing routine ? for example if I want to add a 3D textured/shaded cube...
about old effects, err...so much ! ;D
texts effects with bitmap fonts : I didn't test it yet with ortho
-
Sure, it's relatively easy to switch between Orthographic and Perspective, you just have to set up the GL_PROJECTION matrix properly. You can do that multiple times during a scene. Same with texturing.
The coordinates look odd to me, remember -1 is now 1 pixel off the left of the screen!
It looks like it's only drawing from -1 to 1 in X. You can fix that by
X = X + 1
X = X * SCREEN_WIDTH/2
Jim
-
Jim,
I tried running your exe here (glsample.exe) sand I get:
"This application failed to start becuase the application configuration is incorrect. Reinstalling the application..." etc
Any idea why? Win XP, SP2, Ati x800, Omega drivers.
Chris
-
You don't have the VC2005 runtime libraries installed.
http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en)
Jim
-
You don't have the VC2005 runtime libraries installed.
http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en)
Jim
I have VC++ Express installed (and used daily) which I think means I must have the VC2005 doesnt it?
Chris
-
That's definitely what that error means. Perhaps it's to do with the fact I have VS2005 SP1 installed so my runtime requirements are slightly newer?
Jim
-
You don't have the VC2005 runtime libraries installed.
http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en)
Jim
I have VC++ Express installed (and used daily) which I think means I must have the VC2005 doesnt it?
Chris
Works fine here, and the only non standard dll that it import is MSVCR80.dll, maybe you have one corrupted dll or it was deleted ???
-
Thanks for the help guys, its weird and I'm going to leave this alone as its so much hassle getting VC++ to work in the first place. This is the only application I have ever known to fail :-(.
-
Grab the dll from here
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr80 (http://www.dll-files.com/dllindex/dll-files.shtml?msvcr80)
and stick it in the directory with the exe.
It's possible that's not the right version though - there are many versions of msvcr80.dll, because it had security issues originally, so it's been updated. VC2005 SP1 executables require (via a manifest) a specific minimum revision of the dll to link to at run time.
The only other fix for me is to post an exe linked to a static runtime...(attached)
Jim
-
That cured the problem Jim - thanks.
So, what does that mean - that I have an old version of that dll?
-
I think so. VS2005 has had a service pack and, as I stated in another thread, I think it now generates exes that require a newer version of msvcr80.dll due to security patches. Do you have the latest .net framework patches from Mcrosoft Update?
Jim
-
Actually no (I adopt a policy of upgrade when I must). So that explains it all.
-
Hi ...
Just started coding in OPenGL and im interrested in the same effects as here written.
So it would be cool if someone has a bit code for scrollers etc...
Cheers and thanks
eNeRGy
-
If you'd like to start a new thread with specific questions that would be cool :)
Jim
-
One way to do oldskool type 2d effects in openGL (and this is the way I used) is to code like you always do and never mind the openGL part.
Here's how:
Code ala PTC (which means on a buffer better to use 32 bits since it's easier to upload it later but there's a way to upload 8 bit images to opengl)
Be sure that your software buffer size is a power of 2 (if you want a 640x480 screen), you should use a 1024x1024 buffer)
Then for each frame...
Code your effect on the buffer
upload the buffer to an opengl texture(using glteximage2d or gltexsubimage2d)
blit the texture to screen using glquads
that's it.
I used it on one of my games. Note that the screen is rendered on a buffer whether you use OGL or Software as the render engine.
Code is FB17b though so there are lots of pointer hacks.
http://rel.betterwebber.com/index.php?action=contents&item=marvelous_twilight
I found a better and smaller demo on how to do this, check out effects.bas and display.bas.
Spacebar to skip effect
-
@rel yep thats a great way. i used it to do ogl sin waved text in a couple of my demos.
the only thing is that its quite slow even using gltexsubimage2d for updating the vram. i think personaly that shaders are the way to go for oldskool stuff as they give you the speed and they are more apropriet for 3d hardware in real time.
although they are tricky to learn.
-
@ninogenio: I tend to disagree, it depends on what you do. As long as the texture in VRAM has the same format as the memory region you want to upload, it's really fast.
and shaders for old-school demos/intros/etc... well, yes but there are simpler ways too. None of my remakes use shaders or gl extensions to simulate the Amiga's copper.
-
well yes your right stormbringer,
for say a single full screen vram buffer emulating a ptc viewport. gltexsub2dimage is pretty fast although in my own test marginally slower than ptc but what i mean when i say its a bit slow is eg..
a cube with 6 difrrent double bufferd textures, each texture at 512x512 and diffrent effects going off on each texture then this methode is slow in comparison with shaders.
at the end of the day any vmem,sysmem poking is slow thats why i say shaders are better for this stuff but..
i guess it all comes down to prefrence if your good with shaders and your app is too slow with glteximage then use them or else use teximage.
-
it really depends on what you want to do. it's clear that shaders are the best in terms of performance. But as you mentioned old-schoold effects, not all of them need shaders and some good C code with in-memory drawing can be quite fast as well. I'm not using any framework like PTC, so I always write appropriate code for the effects. This way I can keep control on what I do.
One example I can thing of that would be better with shaders is stencil vectors..
-
@rel yep thats a great way. i used it to do ogl sin waved text in a couple of my demos.
the only thing is that its quite slow even using gltexsubimage2d for updating the vram. i think personaly that shaders are the way to go for oldskool stuff as they give you the speed and they are more apropriet for 3d hardware in real time.
although they are tricky to learn.
However, not all cards have shader capabilities. Even the WII is still FFP.