Sign in to follow this  
Followers 0
matwachich

[..] Simple OpenGL Image Library

5 posts in this topic

I want to load picture files as openGL texture, i tried to play a bit with GDI+ without any succes

Can I use This to load my images, knowing that it's a static library for c/c++ ???

Thanks!

Share this post


Link to post
Share on other sites



Hello,

You won't be able to use it as a static libaray. You'll have to compile it as a dll.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Thanks for the reply!

My C++ skills are very limited, i won't be able to compile it as a dll

I'm gonna ask google!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Think i found something! http://vosolok2008.narod.ru/index_en.html

In the archive, there are my little tests, doesn't work!

Can someone telle my what i do wrong?

here is the code i use:

#include <OpenGL.au3>
#include "pysoil\soil.dll\soil.au3" ; include inside the zip

Global $scrW = 400, $scrH = 400

_OpenGL_Startup()
Global $hGui = GuiCreate("OpenGL", $scrW, $scrH)
GUISetState(@SW_SHOW)

Global $oGL = _OpenGL_Enable($hGui)
; ---

glMatrixMode($GL_PROJECTION)
glLoadIdentity()
glOrtho(0, $scrW, $scrH, 0, 0, 1) ; coord like in GDI+ (0,0 => Top left corner)
glMatrixMode($GL_MODELVIEW)
glDisable($GL_DEPTH_TEST) ; Not needed for 2D

; ---
glEnable($GL_TEXTURE_2D)
;glHint($GL_PERSPECTIVE_CORRECTION_HINT, $GL_NICEST)

$sPath = "C:\Users\Mat\Desktop\Tofs\Homer Simpson Apple-600960.jpeg" ; remplacé par une image valide
Global $texture = _SOIL_Load_OGL_Texture($sPath, 4, 0, $SOIL_FLAG_POWER_OF_TWO)
ConsoleWrite($texture & " - " & @error & @CRLF)

;glBindTexture($GL_TEXTURE_2D, $texture)
;
;glTexParameteri($GL_TEXTURE_2D, $GL_TEXTURE_MAG_FILTER, $GL_LINEAR);
;glTexParameteri($GL_TEXTURE_2D, $GL_TEXTURE_MIN_FILTER, $GL_LINEAR);
;glTexEnvi($GL_TEXTURE_ENV, $GL_TEXTURE_ENV_MODE, $GL_MODULATE);

; ---
glClearColor(0.0, 0.0, 0.0, 1.0)

Do
    $t = TimerInit()
    
    glClear($GL_COLOR_BUFFER_BIT)
    ; ---
    glBindTexture($GL_TEXTURE_2D, $texture)
    glColor3f(1.0, 1.0, 1.0)
    glBegin($GL_QUADS)
        glTexCoord2d(0,0)
        glVertex2d(10,10)
        ; ---
        glTexCoord2d(0,1)
        glVertex2d(390,10)
        ; ---
        glTexCoord2d(1,1)
        glVertex2d(390,390)
        ; ---
        glTexCoord2d(1,0)
        glVertex2d(10,390)
    glEnd()
    ; ---
    SwapBuffers($oGL)
    
    WinSetTitle($oGL[0], "", Round(1000 / TimerDiff($t)) & " fps")
Until GuiGetMsg() = -3
    
_OpenGL_Disable($oGL)
_OpenGL_Shutdown()

; ##############################################################

Soil.dll.zip

Edited by matwachich

Share this post


Link to post
Share on other sites

Up please

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0