20 May '13 - 02:21 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 ... 21 22 [23] 24 25 ... 28
  Reply  |  Print  
Author Topic: Bass_Vis News and Released Infos  (Read 126841 times)
Pranjal
Posts: 28


« Reply #440 on: 4 Jul '08 - 21:00 »
Reply with quoteQuote

Hi BassFan,

That did the trick!
Works perfect now.

Thanx.
Warm regards,

Pranjal
Logged
BassFan
Guest
« Reply #441 on: 4 Jul '08 - 21:08 »
Reply with quoteQuote

upload new Archiv with fixed BassVis.bas
and fresh Sample for Vb.

greets BassFan
Logged
Knight_Rider
Posts: 131


« Reply #442 on: 5 Jul '08 - 11:48 »
Reply with quoteQuote

mhh... ich bekomm es mal wieder nicht gebacken, dass Windows Media Player Visuals unter VB.NET 08 angezeigt werden... beim vb08 sample ist wmp nicht mal eingebaut, kann es mir also nur bei c# angucken (da funktioniert das WMP-Vis sogar), aber von der sprache versteh ich nicht viel Wink
 also bei mir scheint die visual geladen zu werden, aber die picturebox bleibt schwarz, ich sehe also nichts von der vis!

hoffe du kannst mir nochmal helfen ^^

Dim mediatitle As String = "asd"
                    Dim streamfile As String = "asd"

                    ' create our new plugin
                    If visual_ausfuehrung Is Nothing Then
                        visual_ausfuehrung = New BASS_VIS_EXEC(BASSVISPlugin.BASSVISKIND_WMP.ToString())
                    End If


                    minfos = New BASS_VIS_INFO(mediatitle, streamfile)
                    minfos.Channels = 2
                    minfos.BitRate = 44100
                    minfos.SongTitle = mediatitle

                    BassVis.BASS_VIS_SetInfo(visual_einstellungen, minfos)

                    visual_ausfuehrung.WMP_PluginIndex = 0
                    visual_ausfuehrung.WMP_PresetIndex = 0
                    visual_ausfuehrung.WMP_SrcVisHandle = pb_visualisierung.Handle
                    visual_ausfuehrung.Left = 0
                    visual_ausfuehrung.Top = 0
                    visual_ausfuehrung.Width = pb_visualisierung.Width
                    visual_ausfuehrung.Height = pb_visualisierung.Height

                    BassVis.BASS_VIS_ExecutePlugin(visual_ausfuehrung, visual_einstellungen)


                    BassVis.BASSVIS_SetModulePreset(visual_einstellungen, 0)

                    ' SendMessage Playing Status
                    BassVis.BASS_VIS_SetPlayState(visual_einstellungen, BASSVISPlayState.Play)

                    ' Bass.BASS_RecordInit(0)
                    ' BassVis.BASS_VIS_StartRecord(visual_einstellungen)

                    If strm <> 0 Then
                         BassVis.BASS_VIS_RenderChannel(visual_einstellungen, strm)
                    End If

                    tmrChanInfo.Enabled = True
                    Exit Select

das is mein code - das mit bass_vis_init ist etwas weiter oben, aber ich dachte mir, dass man bei der einen zeile wohl nicht all zuviel falsch machen kann ^^


//

media player visuals aren't working for me... the picturebox stays black when i use the code above... Im using VB.net 08 and there is no WMP sample for this language, so i tried the C# sample (WMP-Visuals are working there) but the problem is that i don't understand much of this language so i can't translate the code to vb correctly Sad hope you can help me Smiley
Logged
BassFan
Guest
« Reply #443 on: 5 Jul '08 - 11:55 »
Reply with quoteQuote

ja sorry ich weiss das es nicht integriert ist Wink
Habe aber auch nicht die zeit vollständige applikationen zu schreiben
und dann noch für jede sprache.

visual_ausfuehrung.WMP_PluginIndex = 0
visual_ausfuehrung.WMP_PresetIndex = 0

Das funktioniert schon mal nicht du benötigst reale werte
also erstmal alles in einer liste speichern oder array wenn du keine liste hast
erst dann kannst du auf die WMP Plugins zugreifen.

Einfach irgendeinen Index anzugeben funktioniert hier nicht.

gruss BassFan
Logged
Knight_Rider
Posts: 131


« Reply #444 on: 5 Jul '08 - 13:29 »
Reply with quoteQuote

also, das ganze wird bei mir jetzt wie folgt initialisiert:
                Case BASSVISPlugin.BASSVISKIND_WMP
                    If visual_ausfuehrung Is Nothing Then
                        visual_ausfuehrung = New BASS_VIS_EXEC(BASSVISPlugin.BASSVISKIND_WMP.ToString())
                    End If

                    visual_ausfuehrung.WMP_PluginIndex = indexnum
                    visual_ausfuehrung.WMP_PresetIndex = VisModules.SelectedIndex
                    visual_ausfuehrung.WMP_SrcVisHandle = pb_visualisierung.Handle
                    visual_ausfuehrung.Left = 0
                    visual_ausfuehrung.Top = 0
                    visual_ausfuehrung.Width = pb_visualisierung.Width
                    visual_ausfuehrung.Height = pb_visualisierung.Height

                    BassVis.BASS_VIS_ExecutePlugin(visual_ausfuehrung, visual_einstellungen)

                    BassVis.BASSVIS_SetModulePreset(visual_einstellungen, VisModules.SelectedIndex)

                    ' Bass.BASS_RecordInit(0)
                    '  BassVis.BASS_VIS_StartRecord(visual_einstellungen)


                    If strm <> 0 Then
                        BassVis.BASS_VIS_RenderChannel(visual_einstellungen, strm)
                    End If

                    tmrChanInfo.Enabled = True
                    Exit Select

wähle ich jetzt aus der listbox eine visualisierung vom WMP aus, kommt ein AccesViolationError bei zeile...
Dim NumModule As Integer = BassVis.BASS_VIS_GetModulePresetCount(visual_einstellungen, lstPlugins.Items(indexnum).ToString())
       
im sub GetPluginInfo Sad
Logged
BassFan
Guest
« Reply #445 on: 5 Jul '08 - 18:11 »
Reply with quoteQuote

Lass mir etwas zeit addiere WMP zum VB_NET Sample
Wird heute wohl noch online gehen

gruss BassFan
Logged
BassFan
Guest
« Reply #446 on: 5 Jul '08 - 19:28 »
Reply with quoteQuote

new Archiv online added WMP to VB_NET Sample for VS2008

greets BassFan
Logged
BassFan
Guest
« Reply #447 on: 16 Jul '08 - 17:56 »
Reply with quoteQuote

vis_BassVis for the Winamp and BassVis

greets BassFan

* 1.jpg (116.57 KB - downloaded 82 times.)
* 2.jpg (115.12 KB - downloaded 76 times.)
* 3.jpg (119.68 KB - downloaded 77 times.)
Logged
BassFan
Guest
« Reply #448 on: 19 Jul '08 - 05:58 »
Reply with quoteQuote

new version online BassVis 2.4.1.1

greets BassFan

* changed.jpg (16.95 KB - downloaded 72 times.)
Logged
BassFan
Guest
« Reply #449 on: 19 Jul '08 - 07:18 »
Reply with quoteQuote

her my last version of vis_BassVis
work with Winamp and BassVis

you have 2 mode

Mode 1
Copy any pictures with a resolution 1024x768 and 24Bit to folder /Data/Images/CompDisk
when change a songtitle then the next picture fade over the old bitmap
is a art slideshow with visualization.

Mode 2
Covermode
Named of cover only Cover.bmp or Cover.jpg 512x512 24Bit
Named for CD only CDLabel.bmp or CDLabel.jpg 512x512 24Bit

copy this in to the Album Folder

you can load it her
http://home.arcor.de/em.weiss/vis_BassVis.rar
additional PitureSet for Change texture and so on can load here
http://home.arcor.de/em.weiss/CompDisk.rar
extract it in the directory named Archive

This work only you copy the DLL and Data Folder to /Plugins in Winamp or your Application Plugins Folder used BassVis

This Plugin is OpenSource you have interest on it then send me a PN (Language Delphi)
greets BassFan
« Last Edit: 19 Jul '08 - 08:32 by BassFan » Logged
Cois
Posts: 10


« Reply #450 on: 28 Jul '08 - 10:21 »
Reply with quoteQuote

Hi,

Is it possible to add vb6 code for the bassbox addin.
I try it myself but always get an error not finding the "Font.tga"

Thanks

Cois
Logged
BassFan
Guest
« Reply #451 on: 28 Jul '08 - 14:12 »
Reply with quoteQuote

Is it possible to add vb6 code for the bassbox addin.
think not.
Quote
I try it myself but always get an error not finding the "Font.tga"
check your use the right path for BBPlugin
should be APP.PATH/BBPLugin

greets BassFan
« Last Edit: 28 Jul '08 - 15:23 by BassFan » Logged
BassFan
Guest
« Reply #452 on: 5 Aug '08 - 05:47 »
Reply with quoteQuote

New Version 2.4.1.2 online

greets BassFan

* 2412.jpg (32.94 KB - downloaded 152 times.)
Logged
Patrice Terrier
Posts: 89


« Reply #453 on: 9 Aug '08 - 18:34 »
Reply with quoteQuote

Emil

I have downloaded your latest BassVis to give it a try, and i must say that "Cois" is right, there is no Font.tga in the BBPlugin folder and you don't provide it either in your ZIP file.

Just curious on how many FPS you have on XP, because here on VISTA all BBPlugins looks very slugish when played from your Delphi example.

I think that you could boost the main message pump using something like this:

Smooth animation

I am using my TIMER technic to perform smooth animation without using the common message pump that hogs the CPU:

          CALL SetTimer(hMain, OPENGL_TIMER, 0, NULL)
          WHILE GetMessage(Msg, NULL, 0, 0)
               IF IsDialogMessage(hMain, Msg) = FALSE THEN
                   CALL TranslateMessage(Msg)
                   CALL DispatchMessage(Msg)
               END IF
          WEND
          CALL KillTimer(hMain, OPENGL_TIMER)
 
For further details, see the second post of this thread: BassBox insight

Cordialy

Patrice Terrier
Link to download the BassBox project
Logged
BassFan
Guest
« Reply #454 on: 9 Aug '08 - 22:18 »
Reply with quoteQuote

@Patrice

Quote
I have downloaded your latest BassVis to give it a try, and i must say that "Cois" is right, there is no Font.tga in the BBPlugin folder and you don't provide it either in your ZIP file.
Font.tga is in the Folder BBPlugin/Texture/Extra and think is available

the BBPlugin Archive can download from here
http://home.arcor.de/em.weiss/BBplugin.rar

Quote
          CALL SetTimer(hMain, OPENGL_TIMER, 0, NULL)
          WHILE GetMessage(Msg, NULL, 0, 0)
               IF IsDialogMessage(hMain, Msg) = FALSE THEN
                   CALL TranslateMessage(Msg)
                   CALL DispatchMessage(Msg)
               END IF
          WEND
          CALL KillTimer(hMain, OPENGL_TIMER)

will show on this if there a problem Wink
i'm not use a standard Timer
create a timer use MMSystem..

  if BB_VisDataThread.VisChan <> 0 then
  begin
    if (m_lId = 0) then
    // create High Resolution Timer use mmsystem
    m_lId := timeSetEvent(25, 300, @TimerProc, BB_RenderHandle, TIME_PERIODIC);
  end;

greets BassFan
« Last Edit: 9 Aug '08 - 22:34 by BassFan » Logged
Patrice Terrier
Posts: 89


« Reply #455 on: 10 Aug '08 - 08:33 »
Reply with quoteQuote

Emil,

Are you using wglSwapBuffers?
(it is very slow on VISTA when running in composited mode)

If you are using it, then could you try to change it to this:

          CALL BBP_PLUGIN(BBP)

          '// Refresh display
          '// CALL wglSwapBuffers(glDC)
          CALL SwapBuffers(glDC)
          CALL InvalidateRect(glCtrl, BYVAL NULL, 0)
          CALL UpdateWindow(glCtrl)


This should speed up things on VISTA (while in AERO mode)

Patrice Terrier
www.zapsolution.com


Logged
Patrice Terrier
Posts: 89


« Reply #456 on: 10 Aug '08 - 08:40 »
Reply with quoteQuote

Emil

Instead of using the Font.tga, try to translate this one to Delphi, it would let you use any True Type font with OpenGL without the need to provide an extra file.

%GL_LIGHTING         = &H0B50
%GL_TEXTURE_2D       = &H0DE1
%GL_MODELVIEW        = &H1700
%GL_PROJECTION       = &H1701
%GL_LIST_BIT         = &H00020000
%GL_UNSIGNED_BYTE    = &H1401

#IF %BBP_NO_GLFONT = 0
    TYPE ZGLFONT
        fontName   AS ASCIIZ * 64 ' The True Type font name.
        fontBase   AS LONG        ' The OpenGL FontBase (do not set this).
        charStart  AS LONG        ' OpenGL starting ASCII character (usually 32).
        charNum    AS LONG        ' OpenGL number of glyphe characters to create(usually 96).
        fontHeight AS LONG        ' The font size (72 DPI).
        fontWeight AS LONG        ' The font weigt.
        fontHandle AS LONG        ' The Win32 font handle
    END TYPE
   
    TYPE SIZEL
        cx AS LONG
        cy AS LONG
    END TYPE
   
    TYPE RECT
        nLeft AS LONG
        nTop AS LONG
        nRight AS LONG
        nBottom AS LONG
    END TYPE
   
    %FW_BOLD             = 700
    %OUT_TT_PRECIS       = 4
    %ANTIALIASED_QUALITY = 4
   
    DECLARE FUNCTION GetStockObject LIB "GDI32.DLL" ALIAS "GetStockObject" (BYVAL nIndex AS LONG) AS DWORD
    DECLARE FUNCTION GetDeviceCaps LIB "GDI32.DLL" ALIAS "GetDeviceCaps" (BYVAL hdc AS DWORD, BYVAL nIndex AS LONG) AS LONG
    DECLARE FUNCTION CreateFont LIB "GDI32.DLL" ALIAS "CreateFontA" (BYVAL nHeight AS LONG, BYVAL nWidth AS LONG, BYVAL nEscapement AS LONG, BYVAL nOrientation AS LONG, BYVAL fnWeight AS LONG, BYVAL fdwItalic AS DWORD, _
            BYVAL fdwUnderline AS DWORD, BYVAL fdwStrikeOut AS DWORD, BYVAL fdwCharSet AS DWORD, BYVAL fdwOutputPrecision AS DWORD, BYVAL fdwClipPrecision AS DWORD, BYVAL fdwQuality AS DWORD, _
            BYVAL fdwPitchAndFamily AS DWORD, lpszFace AS ASCIIZ) AS DWORD
    DECLARE FUNCTION glGenLists LIB "opengl32.dll" ALIAS "glGenLists" (BYVAL range&) AS DWORD
    DECLARE FUNCTION wglUseFontBitmaps LIB "OPENGL32.DLL" ALIAS "wglUseFontBitmapsA" (BYVAL hdc AS DWORD, BYVAL dFirst AS DWORD, BYVAL dCount AS DWORD, BYVAL dListBase AS DWORD) AS LONG
    DECLARE FUNCTION GetTextExtentPoint32 LIB "GDI32.DLL" ALIAS "GetTextExtentPoint32A" (BYVAL hdc AS DWORD, lpsz AS ASCIIZ, BYVAL cbString AS LONG, lpSize AS SIZEL) AS LONG
    DECLARE SUB glDeleteLists LIB "opengl32.dll" ALIAS "glDeleteLists" (BYVAL list AS DWORD, BYVAL range&)
    DECLARE FUNCTION GetClientRect LIB "USER32.DLL" ALIAS "GetClientRect" (BYVAL hwnd AS DWORD, lpRect AS RECT) AS LONG
    DECLARE FUNCTION glIsEnabled LIB "opengl32.dll" ALIAS "glIsEnabled" (BYVAL cap AS DWORD) AS BYTE
    DECLARE SUB glDisable LIB "opengl32.dll" ALIAS "glDisable" (BYVAL cap AS DWORD)
    DECLARE SUB glMatrixMode LIB "opengl32.dll" ALIAS "glMatrixMode" (BYVAL mode AS DWORD)
    DECLARE SUB glPushMatrix LIB "opengl32.dll" ALIAS "glPushMatrix" ()
    DECLARE SUB glLoadIdentity LIB "opengl32.dll" ALIAS "glLoadIdentity" ()
    DECLARE SUB glOrtho LIB "opengl32.dll" ALIAS "glOrtho" (BYVAL nleft AS DOUBLE, BYVAL nright AS DOUBLE, BYVAL bottom AS DOUBLE, BYVAL top AS DOUBLE, BYVAL zNear AS DOUBLE, BYVAL zFar AS DOUBLE)
    DECLARE SUB glColor3f LIB "opengl32.dll" ALIAS "glColor3f" (BYVAL red AS SINGLE, BYVAL green AS SINGLE, BYVAL blue AS SINGLE)
    DECLARE SUB glRasterPos2i LIB "opengl32.dll" ALIAS "glRasterPos2i" (BYVAL x&, BYVAL y&)
    DECLARE SUB glPushAttrib LIB "opengl32.dll" ALIAS "glPushAttrib" (BYVAL mask AS DWORD)
    DECLARE SUB glListBase LIB "opengl32.dll" ALIAS "glListBase" (BYVAL nbase AS DWORD)
    DECLARE SUB glCallLists LIB "opengl32.dll" ALIAS "glCallLists" (BYVAL n&, BYVAL ntype AS DWORD, lists AS ANY)
    DECLARE SUB glPopAttrib LIB "opengl32.dll" ALIAS "glPopAttrib" ()
    DECLARE SUB glPopMatrix LIB "opengl32.dll" ALIAS "glPopMatrix"
   
    FUNCTION BBP_DefaultFont() AS LONG
        STATIC hDefault AS LONG
        IF hDefault = 0 THEN hDefault = GetStockObject(12)      ' %ANSI_VAR_FONT
        FUNCTION = hDefault
    END FUNCTION
   
    SUB BBP_BuildGLfont (BYVAL hDC AS LONG, UseFont AS ZGLFONT)
        LOCAL OldFont AS LONG, lpSize AS SIZEL, hFont AS LONG, LenFontName AS LONG
   
        UseFont.charStart = 32
        UseFont.charNum   = 96
        UseFont.fontBase  = glGenLists(UseFont.charNum)         ' Storage For 96 Characters
        LenFontName = LEN(UseFont.fontName)
        IF hDC = 0 THEN LenFontName = 0
        IF LenFontName THEN
           IF UseFont.fontHeight < 1 THEN UseFont.fontHeight = 10
           UseFont.fontHeight = -1 * (UseFont.fontHeight * GetDeviceCaps(hDC, 90)) \ 72
           IF UseFont.fontWeight = 0 THEN UseFont.fontWeight = %FW_BOLD
           hFont = CreateFont(UseFont.fontHeight, _             ' Height Of Font
                              0, _                              ' Width Of Font
                              0, _                              ' Angle Of Escapement
                              0, _                              ' Orientation Angle
                              UseFont.fontWeight, _             ' Font Weight
                              0, _                              ' Italic
                              0, _                              ' Underline
                              0, _                              ' Strikeout
                              0, _                              ' %ANSI_CHARSET Character Set Identifier
                              %OUT_TT_PRECIS, _                 ' Output Precision
                              0, _                              ' %CLIP_DEFAULT_PRECIS Clipping Precision
                              %ANTIALIASED_QUALITY, _           ' Output Quality
                              0, _                              ' %FF_DONTCARE OR %DEFAULT_PITCH Family And Pitch
                              UseFont.fontName)                 ' Font Name
        ELSE
           hFont = BBP_DefaultFont()
        END IF
        IF hFont THEN
           OldFont = SelectObject(hDC, hFont)                   ' Selects our font
         ' Builds 96 Characters Starting At Character 32
           CALL wglUseFontBitmaps(hDC, UseFont.charStart, UseFont.charNum, UseFont.fontBase)
         ' Get font height
           CALL GetTextExtentPoint32(hDC, "W", 1, lpSize)
           UseFont.fontHeight = lpSize.cy
           CALL SelectObject(hDC, oldfont)                      ' Restore previous selected font
           IF LenFontName THEN UseFont.fontHandle = hFont       ' Save the Win32 font handle
        END IF
    END SUB
   
    SUB BBP_DeleteGLFont (UseFont AS ZGLFONT)
        IF UseFont.fontBase THEN
           CALL glDeleteLists(UseFont.fontBase, UseFont.charNum)       ' Delete All 96 Characters
           IF UseFont.fontHandle THEN DeleteObject(UseFont.fontHandle) ' The Win32 font handle
        END IF
    END SUB
   
    SUB BBP_DrawGLText (BYVAL glWnd AS LONG, UseFont AS ZGLFONT, BYVAL x AS LONG, BYVAL y AS LONG, zTxt AS ASCIIZ, BYVAL ARGB AS LONG)
        LOCAL rc AS RECT, A, R, G, B AS BYTE, cAlpha, cRed, cGreen, cBlue AS SINGLE, WasTexture, WasLighting AS LONG
       
        CALL GetClientRect(glWnd, rc)
   
        WasTexture = glIsEnabled(%GL_TEXTURE_2D)
        IF WasTexture THEN CALL glDisable(%GL_TEXTURE_2D)        ' Turn off textures, didn't want our text textured
        WasLighting = glIsEnabled(%GL_LIGHTING)
        IF WasLighting THEN CALL glDisable(%GL_LIGHTING)         ' Disable Lighting
   
        CALL glMatrixMode(%GL_PROJECTION)
        CALL glPushMatrix()
        CALL glLoadIdentity()
        CALL glOrtho(0.0, rc.nRight, 0.0, rc.nBottom, -1.0, 1.0)
        CALL glMatrixMode(%GL_MODELVIEW)
        CALL glPushMatrix()
        CALL glLoadIdentity()
   
      ' Set color
        CALL BBP_SplitColorARGB(ARGB, A, R, G, B)
        cAlpha = A + 1: cRed = R + 1: cGreen = G + 1: cBlue = B + 1
        CALL glColor3f(cRed / 256, cGreen / 256, cBlue / 256)
      ' Set X,Y location
        CALL glRasterPos2i(x, rc.nBottom - (UseFont.fontHeight - 4) - y)
      ' Draw the text
        CALL glPushAttrib(%GL_LIST_BIT)                           ' Pushes The Display List Bits
             CALL glListBase(UseFont.fontBase - UseFont.charStart)' Sets The Base Character to 0
             CALL glCallLists(LEN(zTxt), %GL_UNSIGNED_BYTE, zTxt) ' Draws The Display List Text
        CALL glPopAttrib()                                        ' Pops The Display List Bits
   
        CALL glPopMatrix()
        CALL glMatrixMode(%GL_PROJECTION)
        CALL glPopMatrix()
        CALL glMatrixMode(%GL_MODELVIEW)
   
        IF WasTexture THEN CALL glEnable(%GL_TEXTURE_2D)          ' Enable texture mode
        IF WasLighting THEN CALL glEnable(%GL_LIGHTING)           ' Enable Lighting
   
        CALL glColor3f(1, 1, 1)                                   ' Back to default color
   
    END SUB
#ENDIF
Logged
BassFan
Guest
« Reply #457 on: 10 Aug '08 - 13:22 »
Reply with quoteQuote

@Patrice

i'm not use wglSwapbuffers

work with this!

    // Refresh display
    if SwapBuffers(glDc) = True then
      Result := True;

    zUpdateWindow(glCtrl, Bool(0));
    ReleaseDC(glCtrl, glDc);

procedure zUpdateWindow (Handle : integer; FlagMode : LongBool);
begin
    InvalidateRect(Handle, nil, FlagMode);
    UpdateWindow(Handle);

end;

greets BassFan
Logged
Patrice Terrier
Posts: 89


« Reply #458 on: 10 Aug '08 - 15:14 »
Reply with quoteQuote

Then, it must be something else, i just checked BassVis on XP and the speed is good with it.

I remember i had the same problem with VISTA when i first played OpenGL with it.
What PIXELFORMATDESCRIPTOR are you using?

...

Logged
BassFan
Guest
« Reply #459 on: 10 Aug '08 - 20:09 »
Reply with quoteQuote

Then, it must be something else, i just checked BassVis on XP and the speed is good with it.

I remember i had the same problem with VISTA when i first played OpenGL with it.
What PIXELFORMATDESCRIPTOR are you using?

...



Create RenderingContex from dglOpenGl.pas

function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, ZBits, StencilBits, AccumBits, AuxBuffers: Integer; Layer: Integer): HGLRC;
const
  OBJ_MEMDC = 10;
  OBJ_ENHMETADC = 12;
  OBJ_METADC = 4;
  PFD_DOUBLEBUFFER = $00000001;
  PFD_STEREO = $00000002;
  PFD_DRAW_TO_WINDOW = $00000004;
  PFD_DRAW_TO_BITMAP = $00000008;
  PFD_SUPPORT_GDI = $00000010;
  PFD_SUPPORT_OPENGL = $00000020;
  PFD_TYPE_RGBA = 0;
  PFD_MAIN_PLANE = 0;
  PFD_OVERLAY_PLANE = 1;
  PFD_UNDERLAY_PLANE = LongWord(-1);
  MemoryDCs = [OBJ_MEMDC, OBJ_METADC, OBJ_ENHMETADC];
var
  PFDescriptor: TPixelFormatDescriptor;
  PixelFormat: Integer;
  AType: DWORD;
begin
  if LibHandle = 0 then
    InitOpenGL;

  FillChar(PFDescriptor, SizeOf(PFDescriptor), 0);

  with PFDescriptor do
  begin
    nSize := SizeOf(PFDescriptor);
    nVersion := 1;
    dwFlags := PFD_SUPPORT_OPENGL;

    AType := GetObjectType(DC);

    if AType = 0 then
      RaiseLastOSError;

    if AType in MemoryDCs then
      dwFlags := dwFlags or PFD_DRAW_TO_BITMAP
    else
      dwFlags := dwFlags or PFD_DRAW_TO_WINDOW;

    if opDoubleBuffered in Options then
      dwFlags := dwFlags or PFD_DOUBLEBUFFER;

    if opGDI in Options then
      dwFlags := dwFlags or PFD_SUPPORT_GDI;

    if opStereo in Options then
      dwFlags := dwFlags or PFD_STEREO;

    iPixelType := PFD_TYPE_RGBA;
    cColorBits := ColorBits;
    cDepthBits := zBits;
    cStencilBits := StencilBits;
    cAccumBits := AccumBits;
    cAuxBuffers := AuxBuffers;

    if Layer = 0 then
      iLayerType := PFD_MAIN_PLANE
    else
    if Layer > 0 then
      iLayerType := PFD_OVERLAY_PLANE
    else
      iLayerType := Byte(PFD_UNDERLAY_PLANE);
  end;

  PixelFormat := ChoosePixelFormat(DC, @PFDescriptor);

  if PixelFormat = 0 then
    RaiseLastOSError;

  if GetPixelFormat(DC) <> PixelFormat then
    if not SetPixelFormat(DC, PixelFormat, @PFDescriptor) then
      RaiseLastOSError;

  DescribePixelFormat(DC, PixelFormat, SizeOf(PFDescriptor), PFDescriptor);

  Result := wglCreateLayerContext(DC, Layer);

  if Result = 0 then
    RaiseLastOSError
  else
    LastPixelFormat := 0;
end;

initialize it with this code

      // OpenGL-Funtionen initialisieren
      if not InitOpenGL then
        Halt;

      glDC := GetDC(glCtrl);

      // Renderkontext erstellen (32 Bit Farbtiefe,
      // 32 Bit Tiefenpuffer, Doublebuffering)
      h_RC := CreateRenderingContext(glDc,
                                     [opDoubleBuffered], 32, 32, 0, 0, 0, 0);
      // Erstellten Renderkontext aktivieren
      ActivateRenderingContext(glDc, h_RC, True);

glCtrl is the Window Handle from Container where render the Vis

activate RenderingContex

procedure ActivateRenderingContext(DC: HDC; RC: HGLRC; loadext: boolean = true);
begin
  Assert((DC <> 0), 'DC must not be 0');
  Assert((RC <> 0), 'RC must not be 0');

  wglMakeCurrent(DC, RC);

  if (loadext) then
    ReadExtensions;

  ReadImplementationProperties;
end;

greets BassFan
« Last Edit: 10 Aug '08 - 20:17 by BassFan » Logged
Pages: 1 ... 21 22 [23] 24 25 ... 28
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines