Is it possible to port this code to OpenGL

I have old DirectX code which “lights” up vertices.
Is it possible to make same thing in OpenGL?
Assuming my vertices have “diffuse/spec” property and i color each vertex according to it’s diffuse color with glColor3f ? I know i used old OpenGL but i need this atm. I know about shaders but i need to get this ported to OpenGL. I dont ask you to do this but i just need some directions/hints/ help.

DX uses the stuff from pVerts array and also takes the color in that this function generated and assigned and renders using DrawPrimitive function:

	if (SUCCEEDED(ID3D_Device->DrawPrimitive(

How to “simulate” DX DrawPrimitive function in OpenGL?
Just assign diffuse and spec colors to vertices and draw using vertex arrays and/or glVertex3f?
And i should get same result?

I have read that MS actually took the idea for DX from OpenGL and basically copied OpenGL and named it DirectX, with just some additional “layers” and stuff.

Here is DX code:

static DWORD numLights_2B93E38 = 0; // 43E38

int __stdcall LightVerts_new(int vertCount, Vert* pVerts, int alwaysZero, unsigned __int8 colourRelated)
	for (int vertIdx = 0; vertIdx < vertCount; vertIdx++)
		float light_r = 0.0f;
		float light_g = 0.0f;
		float light_b = 0.0f;
		for (int j = 0; j < numLights_2B93E38; j++)
			if ((lights_2B959E0[j].field_0_flags & 0x30000) == 0x10000) // Light type ?
				// Check if vertex point is within light radius

				// TODO: This has caused me no end of trouble, it appears no matter if quad or tri the 5th index
				// is used to check the position, this means we always have:
				// vert0
				// vert1
				// vert2
				// vert3 - optional, if tri then nothing
				// ?? 0-4 for lighting, perhaps actually normals ?

				const float dx = pVerts[vertIdx + 4].x - lights_2B959E0[j].field_14_x;
				const float dy = pVerts[vertIdx + 4].y - lights_2B959E0[j].field_18_y;
				const float dz = pVerts[vertIdx + 4].z - lights_2B959E0[j].field_1C_z;

				const float distanceSquared = (dx * dx) + (dy * dy) + (dz * dz);

				if (distanceSquared <= lights_2B959E0[j].field_C_radius_squared)
					const float distance = sqrt(distanceSquared);
					const float normalizedDistance = (lights_2B959E0[j].field_8_radius - distance) * lights_2B959E0[j].field_10_radius_normalized;
					if (normalizedDistance > 0.0f)
						auto lightWithBrightness = normalizedDistance * lights_2B959E0[j].field_4_brightness;
						light_r = light_r + lights_2B959E0[j].field_20_r * lightWithBrightness;
						light_g = light_g + lights_2B959E0[j].field_24_g * lightWithBrightness;
						light_b = light_b + lights_2B959E0[j].field_28_b * lightWithBrightness;

		const float colourConverted = colourRelated * 0.0039215689f;

		const auto diffB2 = (double)(((unsigned int)pVerts[vertIdx].diff >> 16) & 0xFF);
		auto b1 = colourConverted * diffB2 * light_r + gfAmbient_E10838;
		if (b1 > 255.0f)
			b1 = 255.0f;

		const auto diffB1 = (double)((unsigned __int16)pVerts[vertIdx].diff >> 8);
		auto b2 = colourConverted * diffB1 * light_g + gfAmbient_E10838;
		if (b2 > 255.0f)
			b2 = 255.0f;

		auto diffB0 = (double)(unsigned __int8)pVerts[vertIdx].diff;
		auto b3 = colourConverted * diffB0 * light_b + gfAmbient_E10838;
		if (b3 > 255.0f)
			b3 = 255.0f;

		pVerts[vertIdx].diff = (signed int)b3 | pVerts[vertIdx].diff & 0xFF000000 | (((signed int)b2 | ((signed int)b1 << 8)) << 8);

	return 0;

struct Vert
    float x, y, z, w;
    DWORD diff;
    DWORD spec;
    float u, v;

for short, no.
but it would be possible to create the same light from ‘scratch’. There is no ‘material’ variable to set, no light, diffuse, specular or ambient variables either. Making a particular lighting is the lesser part of the problem.
The vertex-data thingie is the same except for the axis-order (y points up, not down).
The problem will be, that the opengl programming-paradigm is fundamentally different.
Remember that the draw(…) function is the last line you need to write … it’s all the code that is needed before that call that is the problem.
First you’ll have to choose between old or new opengl.