It is currently Sun Sep 22, 2019 1:57 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 42 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: OpenGL 3.3 Base (windows)
PostPosted: Sat Dec 24, 2011 1:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
here is a opengl 3.3 base who rely on purebasic libs to start a opengl window

the source is too big to be post here

download: http://demo.ovh.com/en/c08cf4fe380f4738 ... a62d416de/

a example with shaders (included in the archive)
Code:
; *---------------------------------*
; *   OpenGL Base Example           *
; *   xorc1zt                       *
; *   2011                          *
; *---------------------------------*

EnableExplicit
IncludeFile "glbase.pb"

Global quitmainloop.b = #False
Global viewmatrix.MATRIX
Global projmatrix.MATRIX
Global program_id.i

;- Declarations
Declare tickWindow()
Declare onResize( height.i, width.i )
Declare onRender()
Declare onInit()

;- Start
openGLWindow( 100, 100, 800, 600, "Hello OpenGL" )
onInit()

;- Main loop
Repeat
    onRender()
    FlipBuffers()
    tickWindow()
Until quitmainloop

;- Procedures
Procedure tickWindow()
    Select WindowEvent()
        Case #PB_Event_CloseWindow
            quitmainloop = #True
        Case #PB_Event_SizeWindow
            onResize( WindowWidth(0),  WindowHeight(0) )
    EndSelect
EndProcedure

Procedure onResize( width.i,  height.i)
    Debug Str(width)+"x"+Str(height)
    glViewport( 0, 0, width, height )
    projmatrix\perspective( 70, 1, 100, width/height )
EndProcedure

Procedure onRender()
    Define vertex_location.i
    Define color_location.i
    Static angle.f
   
    glClearScreen( 0.2, 0.2, 0.2)

    angle + 1.0
    vertex_location = glGetAttribLocation( program_id, "in_Vertex" )
    glVertexAttribPointer( vertex_location, 3, #GL_FLOAT, #GL_FALSE, 0, ?cubevertex )
    glEnableVertexAttribArray( vertex_location )
   
    color_location = glGetAttribLocation( program_id, "in_Color" )
    glVertexAttribPointer( color_location, 3, #GL_FLOAT, #GL_FALSE, 0, ?cubecolor )
    glEnableVertexAttribArray( color_location )
   
    glUseProgram( program_id )
    glUniformMatrix4fv( glGetUniformLocation( program_id, "projection" ), 1, #GL_FALSE, projmatrix\getAddress() )
   
    viewmatrix\identity()
    viewmatrix\lookAt( 0, 3, 8, 0, 0, 0, 0, 1, 0)
   
    viewmatrix\push()
    viewmatrix\rotateZ(angle)
    glUniformMatrix4fv( glGetUniformLocation( program_id, "modelview" ), 1, #GL_FALSE, viewmatrix\getAddress() )
    glDrawArrays( #GL_TRIANGLES, 0, 36 )
    viewmatrix\pop()
   
    viewmatrix\push()
    viewmatrix\translate(-3,0,0)
    viewmatrix\rotateY(angle)
    glUniformMatrix4fv( glGetUniformLocation( program_id, "modelview" ), 1, #GL_FALSE, viewmatrix\getAddress() )
    glDrawArrays( #GL_TRIANGLES, 0, 36 )
    viewmatrix\pop()
   
    viewmatrix\push()
    viewmatrix\translate(3,0,0)
    viewmatrix\rotateX(angle)
    glUniformMatrix4fv( glGetUniformLocation( program_id, "modelview" ), 1, #GL_FALSE, viewmatrix\getAddress() )
    glDrawArrays( #GL_TRIANGLES, 0, 36 )
    viewmatrix\pop()
   
    glUseProgram( 0 )
   
    glDisableVertexAttribArray( vertex_location )
    glDisableVertexAttribArray( color_location )
   
EndProcedure

Procedure onInit()
    Define vertex_shader.s
    Define fragment_shader.s
   
    viewmatrix = createMatrix("viewmatrix")
    projmatrix = createMatrix("projmatrix")
   
    ;vertex shader source code
    vertex_shader = "#version 330"+#CRLF$
    vertex_shader + "in vec3 in_Vertex;"+#CRLF$
    vertex_shader + "in vec3 in_Color;"+#CRLF$
    vertex_shader + "out vec3 color;"+#CRLF$
    vertex_shader + "uniform mat4 projection;"+#CRLF$
    vertex_shader + "uniform mat4 modelview;"+#CRLF$
    vertex_shader + "void main()"+#CRLF$
    vertex_shader + "{"+#CRLF$
    vertex_shader + "gl_Position = projection * modelview * vec4(in_Vertex, 1.0);"+#CRLF$
    vertex_shader + "color = in_Color;"+#CRLF$
    vertex_shader + "}"
   
    ;fragment shader source code
    fragment_shader = "#version 330"+#CRLF$
    fragment_shader + "in vec3 color;"+#CRLF$
    fragment_shader + "out vec4 out_Color;"+#CRLF$
    fragment_shader + "void main()"+#CRLF$
    fragment_shader + "{"+#CRLF$
    fragment_shader + "out_Color = vec4(color, 1.0);"+#CRLF$
    fragment_shader + "}"
   
    program_id = createProgramFast(vertex_shader, fragment_shader)
EndProcedure

DataSection
    cubecolor:
    cubevertex:
    Data.f  1.0, 1.0,-1.0; north
    Data.f -1.0,-1.0,-1.0
    Data.f -1.0, 1.0,-1.0
    Data.f  1.0, 1.0,-1.0
    Data.f  1.0,-1.0,-1.0
    Data.f -1.0,-1.0,-1.0
   
    Data.f -1.0,-1.0,-1.0; west
    Data.f -1.0,-1.0, 1.0 
    Data.f -1.0, 1.0, 1.0   
    Data.f -1.0,-1.0,-1.0
    Data.f -1.0, 1.0, 1.0
    Data.f -1.0, 1.0,-1.0
   
    Data.f  1.0, 1.0, 1.0; east
    Data.f  1.0,-1.0,-1.0
    Data.f  1.0, 1.0,-1.0
    Data.f  1.0,-1.0,-1.0
    Data.f  1.0, 1.0, 1.0
    Data.f  1.0,-1.0, 1.0
   
    Data.f -1.0, 1.0, 1.0; south
    Data.f -1.0,-1.0, 1.0
    Data.f  1.0,-1.0, 1.0
    Data.f  1.0, 1.0, 1.0
    Data.f -1.0, 1.0, 1.0
    Data.f  1.0,-1.0, 1.0

    Data.f  1.0, 1.0, 1.0; top
    Data.f  1.0, 1.0,-1.0
    Data.f -1.0, 1.0,-1.0   
    Data.f  1.0, 1.0, 1.0
    Data.f -1.0, 1.0,-1.0
    Data.f -1.0, 1.0, 1.0
   
    Data.f  1.0,-1.0, 1.0; bot
    Data.f -1.0,-1.0, 1.0
    Data.f -1.0,-1.0,-1.0
    Data.f -1.0,-1.0,-1.0
    Data.f  1.0,-1.0,-1.0
    Data.f  1.0,-1.0, 1.0
EndDataSection


the procedures:

openGLWindow(posX.i, posY.i, width.i, height.i, title.s)
- init opengl and open a window

loadShader(type.l, source.s, sourcetype.b=0)
- load a shader and return the opengl id. if sourcetype is set on true the shader is load from a file
ex: loadShader( #GL_VERTEX_SHADER, "shaders\vertex_shader.txt" , #True )

createProgram( vertexshaderID.i, fragmentshaderID.i )
- create a program, link the shaders and return the opengl id

createProgramFast(vertex_shader.s, fragment_shader.s, sourcetype.b=0)
- loadshader + createprogram combo (shaders are automatically deleted).

the matrix stuffs is included too (viewtopic.php?f=16&t=48613)

set #TRACEFUNCTION to false to turn off the debug tracing
you can start the application with the launch command "-eraselog" to erase the log file


Last edited by xorc1zt on Sun Dec 25, 2011 7:46 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sat Dec 24, 2011 6:32 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3392
Location: New Zealand
nice thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sat Dec 24, 2011 6:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 06, 2010 10:16 am
Posts: 556
Location: Belgium
Hi xorc1zt,

Thanks for this, welcome for learning some things about OPEN GL.

_________________
- every professional was once an amateur - greetings from Pajottenland - Belgium -
http://www.marc-systems.be
PS: sorry for my english I speak flemish ...


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sun Dec 25, 2011 11:23 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4502
Location: Lyon - France
I'm again alone to have an error under XP PB v4.60 at this line :
Code:
LogTXT("OpenGL Shader: "    +#TAB$+#TAB$+   glGetString( #GL_SHADING_LANGUAGE_VERSION) )

Quote:
The specified address is null
I have however write "OpenGL" in the compilator subsystem :(

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sun Dec 25, 2011 1:51 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 06, 2010 10:16 am
Posts: 556
Location: Belgium
@Kwaï chang caïne

Quote:
I'm again alone to have an error under XP PB v4.60 at this line


No, you are NOT alone, I just waited for you, to reply your problems... :mrgreen: :twisted:

Marc,

_________________
- every professional was once an amateur - greetings from Pajottenland - Belgium -
http://www.marc-systems.be
PS: sorry for my english I speak flemish ...


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sun Dec 25, 2011 7:00 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
could you post the Log.txt which appear in the same folder please

edit:

fixed code : http://demo.ovh.com/en/c08cf4fe380f4738 ... a62d416de/.

or replace
Code:
Macro glGetString(name)
    PeekS( glGetString_(name) )
EndMacro


with
Code:
Procedure.s glGetString(name)
    Define *stringpointer
   
    *stringpointer = glGetString_(name)
   
    If *stringpointer
        ProcedureReturn PeekS( *stringpointer )
    EndIf
   
    ProcedureReturn "#NULL"
EndProcedure


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sun Dec 25, 2011 7:29 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4502
Location: Lyon - France
xorc1zt wrote:
could you post the Log.txt which appear in the same folder please
No problem :D
Quote:
[ Hello OpenGL ] Start
Build on 25/12/2011 - 19:27:41
--- Loading OpenGL Functions:
glCullFace: 0x5F073B64
glFrontFace: 0x5F073C68
glHint: 0x5F073C9C
glLineWidth: 0x5F073EA4
glPointSize: 0x5F073ED8
glPolygonMode: 0x5F073F0C
glScissor: 0x5F073F74
glTexParameterf: 0x5F074010
glTexParameterfv: 0x5F074044
glTexParameteri: 0x5F074078
glTexParameteriv: 0x5F0740AC
glTexImage1D: 0x5F07328C
glTexImage2D: 0x5F0732C0
glDrawBuffer: 0x5F074488
glClear: 0x5F073124
glClearColor: 0x5F0731C0
glClearStencil: 0x5F0731F4
glClearDepth: 0x5F073228
glStencilMask: 0x5F0744BC
glColorMask: 0x5F0744F0
glDepthMask: 0x5F074524
glDisable: 0x5F072E48
glEnable: 0x5F072E54
glFinish: 0x5F073FA8
glFlush: 0x5F0745C0
glBlendFunc: 0x5F074830
glLogicOp: 0x5F074864
glStencilFunc: 0x5F074898
glStencilOp: 0x5F0748CC
glDepthFunc: 0x5F074900
glPixelStoref: 0x5F0749D0
glPixelStorei: 0x5F074A04
glReadBuffer: 0x5F074AD4
glReadPixels: 0x5F073328
glGetBooleanv: 0x5F074B08
glGetDoublev: 0x5F074B70
glGetError: 0x5F074BA4
glGetFloatv: 0x5F074BD8
glGetIntegerv: 0x5F074C0C
glGetString: 0x5F074E7C
glGetTexImage: 0x5F074FB4
glGetTexParameterfv: 0x5F074FE8
glGetTexParameteriv: 0x5F07501C
glGetTexLevelParameterfv: 0x5F075050
glGetTexLevelParameteriv: 0x5F075084
glIsEnabled: 0x5F0750B8
glDepthRange: 0x5F075120
glViewport: 0x5F0751BC
glDrawArrays: 0x5F072FC8
glDrawElements: 0x5F072FD4
glGetPointerv: 0x5F073058
glPolygonOffset: 0x5F073034
glCopyTexImage1D: 0x5F075224
glCopyTexImage2D: 0x5F075258
glCopyTexSubImage1D: 0x5F07528C
glCopyTexSubImage2D: 0x5F0752C0
glTexSubImage1D: 0x5F0753C4
glTexSubImage2D: 0x5F0753F8
glBindTexture: 0x5F072FA4
glDeleteTextures: 0x5F0752F4
glGenTextures: 0x5F075328
glIsTexture: 0x5F07535C
glBlendColor: Not found !!!
glBlendEquation: Not found !!!
glDrawRangeElements: Not found !!!
glTexImage3D: Not found !!!
glTexSubImage3D: Not found !!!
glCopyTexSubImage3D: Not found !!!
glActiveTexture: Not found !!!
glSampleCoverage: Not found !!!
glCompressedTexImage3D: Not found !!!
glCompressedTexImage2D: Not found !!!
glCompressedTexImage1D: Not found !!!
glCompressedTexSubImage3D: Not found !!!
glCompressedTexSubImage2D: Not found !!!
glCompressedTexSubImage1D: Not found !!!
glGetCompressedTexImage: Not found !!!
glBlendFuncSeparate: Not found !!!
glMultiDrawArrays: Not found !!!
glMultiDrawElements: Not found !!!
glPointParameterf: Not found !!!
glPointParameterfv: Not found !!!
glPointParameteri: Not found !!!
glPointParameteriv: Not found !!!
glGenQueries: Not found !!!
glDeleteQueries: Not found !!!
glIsQuery: Not found !!!
glBeginQuery: Not found !!!
glEndQuery: Not found !!!
glGetQueryiv: Not found !!!
glGetQueryObjectiv: Not found !!!
glGetQueryObjectuiv: Not found !!!
glBindBuffer: Not found !!!
glDeleteBuffers: Not found !!!
glGenBuffers: Not found !!!
glIsBuffer: Not found !!!
glBufferData: Not found !!!
glBufferSubData: Not found !!!
glMapBuffer: Not found !!!
glUnmapBuffer: Not found !!!
glGetBufferParameteriv: Not found !!!
glGetBufferPointerv: Not found !!!
glBlendEquationSeparate: Not found !!!
glDrawBuffers: Not found !!!
glStencilOpSeparate: Not found !!!
glStencilFuncSeparate: Not found !!!
glStencilMaskSeparate: Not found !!!
glAttachShader: Not found !!!
glBindAttribLocation: Not found !!!
glCompileShader: Not found !!!
glCreateProgram: Not found !!!
glCreateShader: Not found !!!
glDeleteProgram: Not found !!!
glDeleteShader: Not found !!!
glDetachShader: Not found !!!
glDisableVertexAttribArray: Not found !!!
glEnableVertexAttribArray: Not found !!!
glGetActiveAttrib: Not found !!!
glGetActiveUniform: Not found !!!
glGetAttachedShaders: Not found !!!
glGetAttribLocation: Not found !!!
glGetProgramiv: Not found !!!
glGetProgramInfoLog: Not found !!!
glGetShaderiv: Not found !!!
glGetShaderInfoLog: Not found !!!
glGetShaderSource: Not found !!!
glGetUniformLocation: Not found !!!
glGetUniformfv: Not found !!!
glGetUniformiv: Not found !!!
glGetVertexAttribdv: Not found !!!
glGetVertexAttribfv: Not found !!!
glGetVertexAttribiv: Not found !!!
glGetVertexAttribPointerv: Not found !!!
glIsProgram: Not found !!!
glIsShader: Not found !!!
glLinkProgram: Not found !!!
glShaderSource: Not found !!!
glUseProgram: Not found !!!
glUniform1f: Not found !!!
glUniform2f: Not found !!!
glUniform3f: Not found !!!
glUniform4f: Not found !!!
glUniform1i: Not found !!!
glUniform2i: Not found !!!
glUniform3i: Not found !!!
glUniform4i: Not found !!!
glUniform1fv: Not found !!!
glUniform2fv: Not found !!!
glUniform3fv: Not found !!!
glUniform4fv: Not found !!!
glUniform1iv: Not found !!!
glUniform2iv: Not found !!!
glUniform3iv: Not found !!!
glUniform4iv: Not found !!!
glUniformMatrix2fv: Not found !!!
glUniformMatrix3fv: Not found !!!
glUniformMatrix4fv: Not found !!!
glValidateProgram: Not found !!!
glVertexAttrib1d: Not found !!!
glVertexAttrib1dv: Not found !!!
glVertexAttrib1f: Not found !!!
glVertexAttrib1fv: Not found !!!
glVertexAttrib1s: Not found !!!
glVertexAttrib1sv: Not found !!!
glVertexAttrib2d: Not found !!!
glVertexAttrib2dv: Not found !!!
glVertexAttrib2f: Not found !!!
glVertexAttrib2fv: Not found !!!
glVertexAttrib2s: Not found !!!
glVertexAttrib2sv: Not found !!!
glVertexAttrib3d: Not found !!!
glVertexAttrib3dv: Not found !!!
glVertexAttrib3f: Not found !!!
glVertexAttrib3fv: Not found !!!
glVertexAttrib3s: Not found !!!
glVertexAttrib3sv: Not found !!!
glVertexAttrib4Nbv: Not found !!!
glVertexAttrib4Niv: Not found !!!
glVertexAttrib4Nsv: Not found !!!
glVertexAttrib4Nub: Not found !!!
glVertexAttrib4Nubv: Not found !!!
glVertexAttrib4Nuiv: Not found !!!
glVertexAttrib4Nusv: Not found !!!
glVertexAttrib4bv: Not found !!!
glVertexAttrib4d: Not found !!!
glVertexAttrib4dv: Not found !!!
glVertexAttrib4f: Not found !!!
glVertexAttrib4fv: Not found !!!
glVertexAttrib4iv: Not found !!!
glVertexAttrib4s: Not found !!!
glVertexAttrib4sv: Not found !!!
glVertexAttrib4ubv: Not found !!!
glVertexAttrib4Nusv: Not found !!!
glVertexAttrib4usv: Not found !!!
glVertexAttribPointer: Not found !!!
glUniformMatrix2x3fv: Not found !!!
glUniformMatrix3x2fv: Not found !!!
glUniformMatrix2x4fv: Not found !!!
glUniformMatrix4x2fv: Not found !!!
glUniformMatrix3x4fv: Not found !!!
glUniformMatrix4x3fv: Not found !!!
glColorMaski: Not found !!!
glGetBooleani_v: Not found !!!
glGetIntegeri_v: Not found !!!
glEnablei: Not found !!!
glDisablei: Not found !!!
glIsEnabledi: Not found !!!
glBeginTransformFeedback: Not found !!!
glEndTransformFeedback: Not found !!!
glBindBufferRange: Not found !!!
glBindBufferBase: Not found !!!
glTransformFeedbackVaryings: Not found !!!
glGetTransformFeedbackVarying: Not found !!!
glClampColor: Not found !!!
glBeginConditionalRender: Not found !!!
glEndConditionalRender: Not found !!!
glVertexAttribIPointer: Not found !!!
glGetVertexAttribIiv: Not found !!!
glGetVertexAttribIuiv: Not found !!!
glVertexAttribI1i: Not found !!!
glVertexAttribI2i: Not found !!!
glVertexAttribI3i: Not found !!!
glVertexAttribI4i: Not found !!!
glVertexAttribI1ui: Not found !!!
glVertexAttribI2ui: Not found !!!
glVertexAttribI3ui: Not found !!!
glVertexAttribI4ui: Not found !!!
glVertexAttribI1iv: Not found !!!
glVertexAttribI2iv: Not found !!!
glVertexAttribI3iv: Not found !!!
glVertexAttribI4iv: Not found !!!
glVertexAttribI1uiv: Not found !!!
glVertexAttribI2uiv: Not found !!!
glVertexAttribI3uiv: Not found !!!
glVertexAttribI4uiv: Not found !!!
glVertexAttribI4bv: Not found !!!
glVertexAttribI4sv: Not found !!!
glVertexAttribI4ubv: Not found !!!
glVertexAttribI4usv: Not found !!!
glGetUniformuiv: Not found !!!
glBindFragDataLocation: Not found !!!
glGetFragDataLocation: Not found !!!
glUniform1ui: Not found !!!
glUniform2ui: Not found !!!
glUniform3ui: Not found !!!
glUniform4ui: Not found !!!
glUniform1uiv: Not found !!!
glUniform2uiv: Not found !!!
glUniform3uiv: Not found !!!
glUniform4uiv: Not found !!!
glTexParameterIiv: Not found !!!
glTexParameterIuiv: Not found !!!
glGetTexParameterIiv: Not found !!!
glGetTexParameterIuiv: Not found !!!
glClearBufferiv: Not found !!!
glClearBufferuiv: Not found !!!
glClearBufferfv: Not found !!!
glClearBufferfi: Not found !!!
glGetStringi: Not found !!!
glDrawArraysInstanced: Not found !!!
glDrawElementsInstanced: Not found !!!
glTexBuffer: Not found !!!
glPrimitiveRestartIndex: Not found !!!
glGetInteger64i_v: Not found !!!
glGetBufferParameteri64v: Not found !!!
glFramebufferTexture: Not found !!!
glVertexAttribDivisor: Not found !!!
glIsRenderbuffer: Not found !!!
glBindRenderbuffer: Not found !!!
glDeleteRenderbuffers: Not found !!!
glGenRenderbuffers: Not found !!!
glRenderbufferStorage: Not found !!!
glGetRenderbufferParameteriv: Not found !!!
glIsFramebuffer: Not found !!!
glBindFramebuffer: Not found !!!
glDeleteFramebuffers: Not found !!!
glGenFramebuffers: Not found !!!
glCheckFramebufferStatus: Not found !!!
glFramebufferTexture1D: Not found !!!
glFramebufferTexture2D: Not found !!!
glFramebufferTexture3D: Not found !!!
glFramebufferRenderbuffer: Not found !!!
glGetFramebufferAttachmentParameteriv: Not found !!!
glGenerateMipmap: Not found !!!
glBlitFramebuffer: Not found !!!
glRenderbufferStorageMultisample: Not found !!!
glFramebufferTextureLayer: Not found !!!
OpenGL Extensions Loaded

--- OpenGL Infos:
OpenGL Vendor: Microsoft Corporation
OpenGL Renderer: GDI Generic
OpenGL Version: 1.1.0

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sun Dec 25, 2011 7:31 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4502
Location: Lyon - France
After I have replace like you have say, in GlBase.pb
Code:
Macro glGetString(name)
    PeekS( glGetString_(name) )
EndMacro

by
Code:
Procedure.s glGetString(name)
    Define *stringpointer
   
    *stringpointer = glGetString_(name)
   
    If *stringpointer
        ProcedureReturn PeekS( *stringpointer )
    EndIf
   
    ProcedureReturn "#NULL"
EndProcedure
And i have an error "Invalid memory access error" at line
Code:
 id = glCreateShader(type)
:(
Quote:
[ Hello OpenGL ] Start
Build on 25/12/2011 - 19:32:05

--- Loading OpenGL Functions:
glCullFace: 0x5F073B64
glFrontFace: 0x5F073C68
glHint: 0x5F073C9C
glLineWidth: 0x5F073EA4
glPointSize: 0x5F073ED8
glPolygonMode: 0x5F073F0C
glScissor: 0x5F073F74
glTexParameterf: 0x5F074010
glTexParameterfv: 0x5F074044
glTexParameteri: 0x5F074078
glTexParameteriv: 0x5F0740AC
glTexImage1D: 0x5F07328C
glTexImage2D: 0x5F0732C0
glDrawBuffer: 0x5F074488
glClear: 0x5F073124
glClearColor: 0x5F0731C0
glClearStencil: 0x5F0731F4
glClearDepth: 0x5F073228
glStencilMask: 0x5F0744BC
glColorMask: 0x5F0744F0
glDepthMask: 0x5F074524
glDisable: 0x5F072E48
glEnable: 0x5F072E54
glFinish: 0x5F073FA8
glFlush: 0x5F0745C0
glBlendFunc: 0x5F074830
glLogicOp: 0x5F074864
glStencilFunc: 0x5F074898
glStencilOp: 0x5F0748CC
glDepthFunc: 0x5F074900
glPixelStoref: 0x5F0749D0
glPixelStorei: 0x5F074A04
glReadBuffer: 0x5F074AD4
glReadPixels: 0x5F073328
glGetBooleanv: 0x5F074B08
glGetDoublev: 0x5F074B70
glGetError: 0x5F074BA4
glGetFloatv: 0x5F074BD8
glGetIntegerv: 0x5F074C0C
glGetString: 0x5F074E7C
glGetTexImage: 0x5F074FB4
glGetTexParameterfv: 0x5F074FE8
glGetTexParameteriv: 0x5F07501C
glGetTexLevelParameterfv: 0x5F075050
glGetTexLevelParameteriv: 0x5F075084
glIsEnabled: 0x5F0750B8
glDepthRange: 0x5F075120
glViewport: 0x5F0751BC
glDrawArrays: 0x5F072FC8
glDrawElements: 0x5F072FD4
glGetPointerv: 0x5F073058
glPolygonOffset: 0x5F073034
glCopyTexImage1D: 0x5F075224
glCopyTexImage2D: 0x5F075258
glCopyTexSubImage1D: 0x5F07528C
glCopyTexSubImage2D: 0x5F0752C0
glTexSubImage1D: 0x5F0753C4
glTexSubImage2D: 0x5F0753F8
glBindTexture: 0x5F072FA4
glDeleteTextures: 0x5F0752F4
glGenTextures: 0x5F075328
glIsTexture: 0x5F07535C
glBlendColor: Not found !!!
glBlendEquation: Not found !!!
glDrawRangeElements: Not found !!!
glTexImage3D: Not found !!!
glTexSubImage3D: Not found !!!
glCopyTexSubImage3D: Not found !!!
glActiveTexture: Not found !!!
glSampleCoverage: Not found !!!
glCompressedTexImage3D: Not found !!!
glCompressedTexImage2D: Not found !!!
glCompressedTexImage1D: Not found !!!
glCompressedTexSubImage3D: Not found !!!
glCompressedTexSubImage2D: Not found !!!
glCompressedTexSubImage1D: Not found !!!
glGetCompressedTexImage: Not found !!!
glBlendFuncSeparate: Not found !!!
glMultiDrawArrays: Not found !!!
glMultiDrawElements: Not found !!!
glPointParameterf: Not found !!!
glPointParameterfv: Not found !!!
glPointParameteri: Not found !!!
glPointParameteriv: Not found !!!
glGenQueries: Not found !!!
glDeleteQueries: Not found !!!
glIsQuery: Not found !!!
glBeginQuery: Not found !!!
glEndQuery: Not found !!!
glGetQueryiv: Not found !!!
glGetQueryObjectiv: Not found !!!
glGetQueryObjectuiv: Not found !!!
glBindBuffer: Not found !!!
glDeleteBuffers: Not found !!!
glGenBuffers: Not found !!!
glIsBuffer: Not found !!!
glBufferData: Not found !!!
glBufferSubData: Not found !!!
glMapBuffer: Not found !!!
glUnmapBuffer: Not found !!!
glGetBufferParameteriv: Not found !!!
glGetBufferPointerv: Not found !!!
glBlendEquationSeparate: Not found !!!
glDrawBuffers: Not found !!!
glStencilOpSeparate: Not found !!!
glStencilFuncSeparate: Not found !!!
glStencilMaskSeparate: Not found !!!
glAttachShader: Not found !!!
glBindAttribLocation: Not found !!!
glCompileShader: Not found !!!
glCreateProgram: Not found !!!
glCreateShader: Not found !!!
glDeleteProgram: Not found !!!
glDeleteShader: Not found !!!
glDetachShader: Not found !!!
glDisableVertexAttribArray: Not found !!!
glEnableVertexAttribArray: Not found !!!
glGetActiveAttrib: Not found !!!
glGetActiveUniform: Not found !!!
glGetAttachedShaders: Not found !!!
glGetAttribLocation: Not found !!!
glGetProgramiv: Not found !!!
glGetProgramInfoLog: Not found !!!
glGetShaderiv: Not found !!!
glGetShaderInfoLog: Not found !!!
glGetShaderSource: Not found !!!
glGetUniformLocation: Not found !!!
glGetUniformfv: Not found !!!
glGetUniformiv: Not found !!!
glGetVertexAttribdv: Not found !!!
glGetVertexAttribfv: Not found !!!
glGetVertexAttribiv: Not found !!!
glGetVertexAttribPointerv: Not found !!!
glIsProgram: Not found !!!
glIsShader: Not found !!!
glLinkProgram: Not found !!!
glShaderSource: Not found !!!
glUseProgram: Not found !!!
glUniform1f: Not found !!!
glUniform2f: Not found !!!
glUniform3f: Not found !!!
glUniform4f: Not found !!!
glUniform1i: Not found !!!
glUniform2i: Not found !!!
glUniform3i: Not found !!!
glUniform4i: Not found !!!
glUniform1fv: Not found !!!
glUniform2fv: Not found !!!
glUniform3fv: Not found !!!
glUniform4fv: Not found !!!
glUniform1iv: Not found !!!
glUniform2iv: Not found !!!
glUniform3iv: Not found !!!
glUniform4iv: Not found !!!
glUniformMatrix2fv: Not found !!!
glUniformMatrix3fv: Not found !!!
glUniformMatrix4fv: Not found !!!
glValidateProgram: Not found !!!
glVertexAttrib1d: Not found !!!
glVertexAttrib1dv: Not found !!!
glVertexAttrib1f: Not found !!!
glVertexAttrib1fv: Not found !!!
glVertexAttrib1s: Not found !!!
glVertexAttrib1sv: Not found !!!
glVertexAttrib2d: Not found !!!
glVertexAttrib2dv: Not found !!!
glVertexAttrib2f: Not found !!!
glVertexAttrib2fv: Not found !!!
glVertexAttrib2s: Not found !!!
glVertexAttrib2sv: Not found !!!
glVertexAttrib3d: Not found !!!
glVertexAttrib3dv: Not found !!!
glVertexAttrib3f: Not found !!!
glVertexAttrib3fv: Not found !!!
glVertexAttrib3s: Not found !!!
glVertexAttrib3sv: Not found !!!
glVertexAttrib4Nbv: Not found !!!
glVertexAttrib4Niv: Not found !!!
glVertexAttrib4Nsv: Not found !!!
glVertexAttrib4Nub: Not found !!!
glVertexAttrib4Nubv: Not found !!!
glVertexAttrib4Nuiv: Not found !!!
glVertexAttrib4Nusv: Not found !!!
glVertexAttrib4bv: Not found !!!
glVertexAttrib4d: Not found !!!
glVertexAttrib4dv: Not found !!!
glVertexAttrib4f: Not found !!!
glVertexAttrib4fv: Not found !!!
glVertexAttrib4iv: Not found !!!
glVertexAttrib4s: Not found !!!
glVertexAttrib4sv: Not found !!!
glVertexAttrib4ubv: Not found !!!
glVertexAttrib4Nusv: Not found !!!
glVertexAttrib4usv: Not found !!!
glVertexAttribPointer: Not found !!!
glUniformMatrix2x3fv: Not found !!!
glUniformMatrix3x2fv: Not found !!!
glUniformMatrix2x4fv: Not found !!!
glUniformMatrix4x2fv: Not found !!!
glUniformMatrix3x4fv: Not found !!!
glUniformMatrix4x3fv: Not found !!!
glColorMaski: Not found !!!
glGetBooleani_v: Not found !!!
glGetIntegeri_v: Not found !!!
glEnablei: Not found !!!
glDisablei: Not found !!!
glIsEnabledi: Not found !!!
glBeginTransformFeedback: Not found !!!
glEndTransformFeedback: Not found !!!
glBindBufferRange: Not found !!!
glBindBufferBase: Not found !!!
glTransformFeedbackVaryings: Not found !!!
glGetTransformFeedbackVarying: Not found !!!
glClampColor: Not found !!!
glBeginConditionalRender: Not found !!!
glEndConditionalRender: Not found !!!
glVertexAttribIPointer: Not found !!!
glGetVertexAttribIiv: Not found !!!
glGetVertexAttribIuiv: Not found !!!
glVertexAttribI1i: Not found !!!
glVertexAttribI2i: Not found !!!
glVertexAttribI3i: Not found !!!
glVertexAttribI4i: Not found !!!
glVertexAttribI1ui: Not found !!!
glVertexAttribI2ui: Not found !!!
glVertexAttribI3ui: Not found !!!
glVertexAttribI4ui: Not found !!!
glVertexAttribI1iv: Not found !!!
glVertexAttribI2iv: Not found !!!
glVertexAttribI3iv: Not found !!!
glVertexAttribI4iv: Not found !!!
glVertexAttribI1uiv: Not found !!!
glVertexAttribI2uiv: Not found !!!
glVertexAttribI3uiv: Not found !!!
glVertexAttribI4uiv: Not found !!!
glVertexAttribI4bv: Not found !!!
glVertexAttribI4sv: Not found !!!
glVertexAttribI4ubv: Not found !!!
glVertexAttribI4usv: Not found !!!
glGetUniformuiv: Not found !!!
glBindFragDataLocation: Not found !!!
glGetFragDataLocation: Not found !!!
glUniform1ui: Not found !!!
glUniform2ui: Not found !!!
glUniform3ui: Not found !!!
glUniform4ui: Not found !!!
glUniform1uiv: Not found !!!
glUniform2uiv: Not found !!!
glUniform3uiv: Not found !!!
glUniform4uiv: Not found !!!
glTexParameterIiv: Not found !!!
glTexParameterIuiv: Not found !!!
glGetTexParameterIiv: Not found !!!
glGetTexParameterIuiv: Not found !!!
glClearBufferiv: Not found !!!
glClearBufferuiv: Not found !!!
glClearBufferfv: Not found !!!
glClearBufferfi: Not found !!!
glGetStringi: Not found !!!
glDrawArraysInstanced: Not found !!!
glDrawElementsInstanced: Not found !!!
glTexBuffer: Not found !!!
glPrimitiveRestartIndex: Not found !!!
glGetInteger64i_v: Not found !!!
glGetBufferParameteri64v: Not found !!!
glFramebufferTexture: Not found !!!
glVertexAttribDivisor: Not found !!!
glIsRenderbuffer: Not found !!!
glBindRenderbuffer: Not found !!!
glDeleteRenderbuffers: Not found !!!
glGenRenderbuffers: Not found !!!
glRenderbufferStorage: Not found !!!
glGetRenderbufferParameteriv: Not found !!!
glIsFramebuffer: Not found !!!
glBindFramebuffer: Not found !!!
glDeleteFramebuffers: Not found !!!
glGenFramebuffers: Not found !!!
glCheckFramebufferStatus: Not found !!!
glFramebufferTexture1D: Not found !!!
glFramebufferTexture2D: Not found !!!
glFramebufferTexture3D: Not found !!!
glFramebufferRenderbuffer: Not found !!!
glGetFramebufferAttachmentParameteriv: Not found !!!
glGenerateMipmap: Not found !!!
glBlitFramebuffer: Not found !!!
glRenderbufferStorageMultisample: Not found !!!
glFramebufferTextureLayer: Not found !!!
OpenGL Extensions Loaded

--- OpenGL Infos:
OpenGL Vendor: Microsoft Corporation
OpenGL Renderer: GDI Generic
OpenGL Version: 1.1.0
OpenGL Shader: #NULL


--- OpenGL Extensions:

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL Base 3.3 (windows)
PostPosted: Sun Dec 25, 2011 7:44 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
Code:
OpenGL Vendor: Microsoft Corporation
OpenGL Renderer: GDI Generic
OpenGL Version: 1.1.0


this code require a gpu with OpenGL 3.3


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL 3.3 Base (windows)
PostPosted: Sun Dec 25, 2011 7:48 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4502
Location: Lyon - France
A ok...thanks for your answer 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL 3.3 Base (windows)
PostPosted: Sun Dec 25, 2011 7:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
about opengl versions: http://en.wikipedia.org/wiki/OpenGL#Releases


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL 3.3 Base (windows)
PostPosted: Tue Feb 14, 2012 11:36 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
new version : http://demo.ovh.com/en/df19bd283c24e716 ... a07c1561d/

+ x64 support
+ the choice between purebasic or winapi
+ pbglSwapBuffers() instead of FlipBuffers()
+ textured cube example
+ texture (a beautiful mspaint sword ) with orthogonal projection example
+ misc stuffs here and there

public functions have now the prefix pbgl and the private ones have _pbgl

with the windows api you can choose a specific opengl version and profile

example for a opengl 3.3 compatibility context
Code:
pbglSetting( #PBGL_GLVERSION_MAJOR, 3 )
pbglSetting( #PBGL_GLVERSION_MINOR, 3 )
pbglSetting( #PBGL_GLPROFILE, #PBGL_GLPROFILE_COMPATIBILITY )
pbglSetting( #PBGL_CONTEXT_CREATION, #PBGL_WINAPI )
pbglOpenWindow( 100, 100, 800, 600, "Hello OpenGL" )


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL 3.3 Base (windows)
PostPosted: Tue Feb 14, 2012 11:50 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 3694
Location: Italy
Thanks for sharing !

I'm doing a opengl helper library me too for PB and the public functions starts with sgl and the private ones with _sgl. I see a pattern :)

_________________
[ My little PureBasic review ]


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL 3.3 Base (windows)
PostPosted: Thu Feb 16, 2012 6:55 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 17, 2009 10:51 pm
Posts: 1341
Location: Nashville
xorc1zt wrote:


Thank you. This looks very interesting.

_________________
Fangbeast for President!


Top
 Profile  
Reply with quote  
 Post subject: Re: OpenGL 3.3 Base (windows)
PostPosted: Thu Feb 16, 2012 12:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
here some useful bookmarks to start with modern OpenGL (shaders, vbo, ...)

http://www.opengl-tutorial.org/
http://www.arcsynthesis.org/gltut/
http://openglbook.com/
http://ogldev.atspace.co.uk/
http://duriansoftware.com/joe/An-intro- ... tents.html
http://sites.google.com/site/opengltutorialsbyaks/
http://www.lighthouse3d.com/
http://www.swiftless.com/
http://www.dhpoware.com/index.html
http://db-in.com/blog/category/opengl/
http://www.g-truc.net/post-opengl.html#menu
http://www.opengl.org/discussion_boards/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye