OpenGL 2.0 drivers

Oh how embarrassing, what’s wrong with the ARB? They’ve only gone and spelt ‘colour’ wrong AGAIN.

CybeRUS : how did you compile a openglSL program to vertex and fragment shader? i want to know, i want to do

Knackered:

Main Entry: col·our
Pronunciation: 'k&-l&r
chiefly British variant of COLOR

So I guess you’re british?

Humus:
Yes, gl_FB is droped from spec, but it’s there in drivers

Mazy:
I compile it by glCompileShaderGL2
It’s GL2_vertex/fragment_shader extensions in driver

Right on brother, you bet yo ass I’m british.
We ‘evolved’ the english language, don’t you know? If we say it’s colour, then it’s goddam colour, got it!? Ain’t no goddam ‘variant’, it’s the goddam root spelling of the word. jeez, brother.

Originally posted by kansler:
[b]Knackered:

Main Entry: col·our
Pronunciation: 'k&-l&r
chiefly British variant of COLOR

So I guess you’re british?[/b]

CybeRUS : you happend to know the exact name and spec for the extension?

edit: looked over the thread again so i guess no ext and no spec, but do i really have to be a member of a russian site in order to get the source?

[This message has been edited by Mazy (edited 05-28-2003).]

You can download: http://www.3dlabs.com/support/developer/ogl2/OGL2SDK.002.zip

But with some fix:

Change from:
#define GL_VERTEX_SHADER_GL2 0x00010
#define GL_FRAGMENT_SHADER_GL2 0x00020
To:
#define GL_VERTEX_SHADER_GL2 0x7010
#define GL_FRAGMENT_SHADER_GL2 0x7011

Or get my source:

#include <stdio.h>
#include <windows.h>

#define USE_IJL 1
#ifdef USE_IJL
#include “IJL\ijl.h”
#pragma comment( lib, “IJL\ijl15.lib” )
#endif

#include <GL\gl.h>
#include <GL\glu.h>
#include <GL\glut.h>

#include

float a,b,c;
UINT tex;

int LoadJPGFile(char FileName)
{
int Height, Width, Bpp;
BYTE Bpp8;
int RetVal;
BYTE img = NULL;
JPEG_CORE_PROPERTIES image;
ZeroMemory( &image, sizeof( JPEG_CORE_PROPERTIES ) );
if( ijlInit( &image ) != IJL_OK )
{
return -1;
}
image.JPGFile = FileName;
if ((RetVal = ijlRead(&image,IJL_JFILE_READPARAMS)) == IJL_OK)
{
Height = image.JPGHeight;
Width = image.JPGWidth;
Bpp8 = 3;
Bpp = Bpp8
8;
UINT ImageSize=Height
Width*Bpp8;
BYTE *img = new BYTE[ImageSize];
if (img)
{
image.DIBBytes = img;
image.DIBColor = IJL_RGB;
image.DIBHeight = Height;
image.DIBWidth = Width;
image.DIBChannels = Bpp8;
if ((RetVal = ijlRead(&image,IJL_JFILE_READWHOLEIMAGE)) == IJL_OK)
{
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
//glTexImage2D(GL_TEXTURE_2D, 0, Bpp == 24?GL_RGB:GL_RGBA, Height, Width, 0, Bpp == 24?GL_RGB:GL_RGBA, GL_UNSIGNED_BYTE, img);
gluBuild2DMipmaps(GL_TEXTURE_2D, Bpp8, Width, Height, Bpp == 24?GL_RGB:GL_RGBA, GL_UNSIGNED_BYTE, img);
}
}

  delete img;

}
ijlFree(&image);

return 0;
}

void redraw()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -1.5f);
glRotatef(160.0f,1.0f,0.0f,0.0f);
glRotatef(0.0f,0.0f,1.0f,0.0f);
glRotatef(c,0.0f,0.0f,1.0f);
glBegin(GL_QUADS);
glTexCoord2f(1,1); glVertex2f(+1,+1);
glTexCoord2f(1,0); glVertex2f(+1,-1);
glTexCoord2f(0,0); glVertex2f(-1,-1);
glTexCoord2f(0,1); glVertex2f(-1,+1);
glEnd();
glutSwapBuffers();
}
void motion(int x, int y)
{
c=x*0.1f;
}
void reshape(int width, int height)
{
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(60,(width+.1)/(height+.1),0.1f,100.0f);
glMatrixMode (GL_MODELVIEW);
glViewport (0, 0, width, height);
}
typedef GLuint (APIENTRY *CreateShaderObjectGL2)(GLenum shaderType);
CreateShaderObjectGL2 CreateShaderObject;
typedef GLvoid (APIENTRY *LoadShaderGL2)(GLuint shaderObj, GLuint nseg, char **seg, const GLint *length);
LoadShaderGL2 LoadShader;
typedef GLboolean (APIENTRY *CompileShaderGL2)(GLuint shaderObj);
CompileShaderGL2 CompileShader;
typedef const char * (APIENTRY *GetInfoLogGL2)(GLuint shaderObj, GLint *length);
GetInfoLogGL2 GetInfoLog;
typedef GLuint (APIENTRY *CreateProgramObjectGL2)(GLvoid);
CreateProgramObjectGL2 CreateProgramObject;
typedef GLboolean (APIENTRY *AttachShaderObjectGL2)(GLuint programObj,GLuint shaderObj);
AttachShaderObjectGL2 AttachShaderObject;
typedef GLboolean (APIENTRY *LinkProgramGL2)(GLuint programObj);
LinkProgramGL2 LinkProgram;
typedef GLboolean (APIENTRY *UseProgramObjectGL2)(GLuint programObj);
UseProgramObjectGL2 UseProgramObject;

#define VERTEX_SHADER_GL2 0x7010
#define FRAGMENT_SHADER_GL2 0x7011

main(int argc, char *argv)
{
glutInit(&argc, argv);
glutInitWindowSize(800,600);
glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE);
glutCreateWindow(“Peter Popov GLUT”);
glutIdleFunc(redraw);
glutDisplayFunc(redraw);
glutMotionFunc(motion);
glutReshapeFunc(reshape);
if (LoadJPGFile(“phong.JPG”))
{
printf(“Error loading texture”);
return -1;
}
printf("Texture loaded.
");
glEnable(GL_TEXTURE_2D);
CreateShaderObject=(CreateShaderObjectGL2)wglGetProcAddress(“glCreateShaderObjectGL2”);
LoadShader=(LoadShaderGL2)wglGetProcAddress(“glLoadShaderGL2”);
CompileShader=(CompileShaderGL2)wglGetProcAddress(“glCompileShaderGL2”);
GetInfoLog=(GetInfoLogGL2)wglGetProcAddress(“glGetInfoLogGL2”);
CreateProgramObject=(CreateProgramObjectGL2)wglGetProcAddress(“glCreateProgramObjectGL2”);
AttachShaderObject =(AttachShaderObjectGL2)wglGetProcAddress(“glAttachShaderObjectGL2”);
LinkProgram = (LinkProgramGL2)wglGetProcAddress(“glLinkProgramGL2”);
UseProgramObject =(UseProgramObjectGL2)wglGetProcAddress(“glUseProgramObjectGL2”);

if (!CreateShaderObject)
{
printf("Critical error!: GL2 Shaders doesn’t support!
");
//return -1;
}
else
{
GLuint fp,vp,obj;
{
FILE *file = fopen(“GL2vertex.vp”, “rb”);
fseek(file, 0, SEEK_END);
int fsize = ftell(file);
fseek(file, 0, SEEK_SET);
char *string = new char[fsize+1];
fread((void *)string, fsize, 1, file);
string[fsize] = 0;
fclose(file);
printf("Vertex program: %s
",string);

  	char **pieces=&string;
  	GLint  length[]={strlen(string)};
  	vp=CreateShaderObject(VERTEX_SHADER_GL2);
  	LoadShader(vp,1,pieces,length);
  	if(!CompileShader(vp))	printf("%s 

",GetInfoLog(vp,length));
else printf("vertex shader was compiled
");

  } 	
  {
  	FILE *file = fopen("GL2fragment.fp", "rb");
  	fseek(file, 0, SEEK_END);
  	int fsize = ftell(file);
  	fseek(file, 0, SEEK_SET);
  	char *string = new char[fsize+1];
  	fread((void *)string, fsize, 1, file);
  	string[fsize] = 0;
  	fclose(file);
  	printf("Fragment program: %s

“,string);
char **pieces=&string;
GLint length={strlen(string)};
fp=CreateShaderObject(FRAGMENT_SHADER_GL2);
LoadShader(fp,1,pieces,length);
if(!CompileShader(fp)) printf(”%s
",GetInfoLog(fp,length));
else printf("fragment shader was compiled
");
}
obj=CreateProgramObject();
if(AttachShaderObject(obj,vp))printf("vertex shader was attached
");
if(AttachShaderObject(obj,fp))printf("fragment shader was attached
");
if(LinkProgram(obj))printf("link completed
");
printf("linking:
%s
",GetInfoLog(obj,NULL));
if(UseProgramObject(obj)) printf("All is Ok!
");
}
glClearColor(1.0,1.0,1.0,1.0);
glutMainLoop();
return 0;
}

thanks alot.

Originally posted by CybeRUS:
Humus:
Yes, gl_FB is droped from spec, but it’s there in drivers

Why develop for something that’s obviously being dropped?

Btw, I don’t think you’re supposed to talk too widely about the actual state of the implementation, (hoping you’re a legitimate user of the GL2 stuff etc)

Originally posted by knackered:
Right on brother, you bet yo ass I’m british.
We ‘evolved’ the english language, don’t you know? If we say it’s colour, then it’s goddam colour, got it!? Ain’t no goddam ‘variant’, it’s the goddam root spelling of the word. jeez, brother.

If the British wouldn’t have constantly been fighting with the french throughout the centuries I would bet the British would have settled for “color” too.

Huh? Aren’t you glad we fought the french?
who likes the french?

Well, they probably like themselves at least

Either way, not sure if it was worth it to destroy the oh so beautiful original language you shared with us scandinavians and germans

hey, CybeRUS , what is 1C’ opinion on your source code posting? (can you get any troubles with that? just curious )

Humus:
I don’t know about actual state of implementation, but in spec of glslang on this site gl_FB is droped.

matt_weird:
Heh, it’s not source from the game, it’s just simple code to get work a glslang.
Btw, i can post any source code, there is no secrets from OpenGL peoples. I write open source game engine (http://gungine.gamedev.ru) to help people get start with OpenGL programming.
I want that OpenGL make things better

i saw GUNgine, guess it’s time to download all the steps, good source of examples (i see you had some updates there recently )

“There’re no secrets for OpenGL people” – this sounds a bit…silly, lol (as there could be some Direct3D people in here as well, hehe

Stop feeding trolls (Knackered and Humus)! They started talking on off-themes!
#include <directkill.h>
HRESULT hRes;
LPELECTRICALCHAIR13 g_pElCh;
LPDIRECTKILL13 g_pK;
g_pK = DirectKillCreate13(DK_SDK_VERSION);
hRes = g_pK->CreateChair(DK_MORTAL_CHAIR, DK_CHAIR_DEFAULT, &g_pElCh);
if(FAILED(hRes)) Expel(“Knackered”, “Humus”);
ass ptr;
g_pElCh->Lock(AND_NEVER_UNLOCK, (ASS
*)&ptr);
freq_contributor_cpy(ptr, &knackered, &humus);
g_pElCh->SetTormentShader(DKFVF_DESTROY);
g_pElCh->SetKillingStageState(0, DK_ALL);
g_pElCh->ExecutePrimitiveHuman();…

http://esprit.campus.luth.se/~humus/temp/tryingtobefunny.jpg

…jeez, just what are they waiting for?? i wanna get GL2.0 and forget even thinking of that D3D puzzle for at least four next years, can i?

GIVE ME GL2.0 RIGHT NOW! RIGHT NOW!! hehehe

No, really, doesn’t the DOOMIII release delay mean that JC is waiting for an official GL2.0 release? Also when it comes out?