Cube Mapping

BlitzMax Forums/OpenGL Module/Cube Mapping

Drey(Posted 2006) [#1]
I know later versions of OpenGL has it. 1.1 does not however. How do we get a more advance openGL to power our graphics?


Chris C(Posted 2006) [#2]
upgrade you drivers you *might* get lucky tho thats doubtful, usually is specific to the graphics cards features


Drey(Posted 2006) [#3]
Well, what i mean is Cube mapping is like OpenGL 1.3 feature i think. I thought blitzmax only uses 1.1. I have an nvidia geforce 6600gt, i'm sure any driver for it has cube mapping. After all, i'm just assuming it wouldn't work in blitzmax because it's not in 1.1. I guess i'll still give it a shot soon.


Chris C(Posted 2006) [#4]
sorry see what you mean now!

You should be ok with cube mapping check elsewhere on this forum tom did an example of cubemapping

from the front end of the api I'm not too sure of the differences for ogl from 1.1 to 1.3 but if you're missing and const's or functions you can always add them...


Drey(Posted 2006) [#5]
true, but i think cube mapping is an API. Thanks for the help.


Chris C(Posted 2006) [#6]
an api is just a collection of functions and constants - nowt magical!


Drey(Posted 2006) [#7]
yeah, but you have to have that collect of those functions in an include file. I'm saying that blitzmax probably doesn't those functions thus it wouldn't work. I have tried newer APIs for OpenGL on it yet. Have you?


Chris C(Posted 2006) [#8]
but you have to have that collect of those functions in an include file

no I usually just add a few commands at the top of the bmx file i'm working on if I find a missing function.

I've had to supply some constants for arb type calls, (and maybe a routine from memory) but not really come across anything max cant handle...

I've even overridden standard opengl calls to log them and then call the opengl routine, which is interesting but slow!

I'd be *really* suprised if you were to find something in opengl that you couldnt do in max


Chris C(Posted 2006) [#9]
http://free.hostdepartment.com/c/chrisc/index.html for the opengl logger if you're interested, you'll see what I mean about just defining functions or in this case redefining them...


Vertex(Posted 2006) [#10]
How to create CubeMap-Texture:

glGenTextures(1, Varptr(TextureID))

glBindTexture(GL_TEXTURE_CUBE_MAP,TextureID)
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT, 0, GL_RGBA, ..
             Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data1)

glBindTexture(GL_TEXTURE_CUBE_MAP,TextureID)
glTexImage2D(GL_TEXTURE_CUBE_MAPNEGATIVE_X_EXT, 0, GL_RGBA, ..
             Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data2)

glBindTexture(GL_TEXTURE_CUBE_MAP,TextureID)
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT, 0, GL_RGBA, ..
             Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data3)

' ...

glBindTexture(GL_TEXTURE_CUBE_MAP,TextureID)
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT, 0, GL_RGBA, ..
             Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data6)


How tu use it:
glEnable(GL_TEXTURE_CUBE_MAP)

glBindTexture(GL_TEXTURE_CUBE_MAP, TextureID)

glEnable(GL_TEXTURE_GEN_S)
glEnable(GL_TEXTURE_GEN_T)
glEnable(GL_TEXTURE_GEN_R)

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB)
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB)
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB)


cu olli


ImaginaryHuman(Posted 2006) [#11]
I thought max was opengl 1.2


Drey(Posted 2006) [#12]
Ok, i thought cube could have only been done with ARB functions. Alright, after i research multiple UV coords per vertex, i can get everything i truly desired for the game's graphics.