|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
sefiroths
Joined: 17 Nov 2009 Posts: 10
|
Posted: Wed Nov 09, 2011 3:07 pm Post subject: opengl textures. do anyone have it make working? |
|
|
i'm trying to display a texture from a image created in memory (a checker).
what i have wrote is:
Code: |
subroutine makeCheckImage()
common/tex/checkImage
integer*1 checkImage(64,64,4)
integer*4 i, j, c,k
do i = 1,64
do j = 1,64
k=i+64*(j-1)
c = 100*mod(k,2)
checkImage(i,j,1) = c;
checkImage(i,j,2) = c;
checkImage(i,j,3) = c;
checkImage(i,j,4) = 100;
enddo
enddo
end
subroutine initForTexture()
common/tex/checkImage
integer*1 checkImage(64,64,4)
integer GL_UNSIGNED_BYTE
PARAMETER (GL_UNSIGNED_BYTE = z'1401')
integer*4 GL_RGBA
PARAMETER (GL_RGBA = z'1908')
integer*4 GL_TEXTURE_MIN_FILTER
PARAMETER (GL_TEXTURE_MIN_FILTER = z'2801')
INTEGER*4 GL_NEAREST
PARAMETER (GL_NEAREST = z'2600')
INTEGER*4 GL_TEXTURE_MAG_FILTER
PARAMETER (GL_TEXTURE_MAG_FILTER = z'2800')
INTEGER*4 GL_TEXTURE_WRAP_T
PARAMETER (GL_TEXTURE_WRAP_T = z'2803')
INTEGER*4 GL_REPEAT
PARAMETER (GL_REPEAT = z'2901')
INTEGER*4 GL_TEXTURE_WRAP_S
PARAMETER (GL_TEXTURE_WRAP_S = z'2802')
INTEGER*4 GL_TEXTURE_2D
PARAMETER (GL_TEXTURE_2D = z'0DE1')
INTEGER*4 GL_UNPACK_ALIGNMENT
PARAMETER (GL_UNPACK_ALIGNMENT = z'0CF5')
INTEGER*4 GL_DEPTH_TEST
PARAMETER (GL_DEPTH_TEST = z'0B71')
INTEGER*4 GL_FLAT
PARAMETER (GL_FLAT = z'1D00')
STDCALL GLENABLE 'glEnable' (VAL)
STDCALL GLTEXIMAGE2D
. 'glTexImage2D' (VAL,VAL,VAL,VAL,VAL,VAL,VAL,VAL,REF)
STDCALL GLPIXELSTOREI 'glPixelStorei' (VAL,VAL)
STDCALL GLGENTEXTURES 'glGenTextures' (VAL,REF)
STDCALL GLBINDTEXTURE 'glBindTexture' (VAL,VAL)
STDCALL GLCLEARCOLOR 'glClearColor' (VAL,VAL,VAL,VAL)
STDCALL GLSHADEMODEL 'glShadeModel' (VAL)
STDCALL GLVERTEX3F 'glVertex3f' (VAL,VAL,VAL)
STDCALL GLTEXENVF 'glTexEnvf' (VAL,VAL,VAL)
STDCALL GLBEGIN 'glBegin' (VAL)
STDCALL GLTEXPARAMETERI 'glTexParameteri' (VAL,VAL,VAL)
integer texName(1)
call glClearColor (0.0, 0.0, 0.0, 0.0);
call glShadeModel(GL_FLAT);
call glEnable(GL_DEPTH_TEST);
call makeCheckImage();
call glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
call glGenTextures(1, texName);
call glBindTexture(GL_TEXTURE_2D, texName(1));
call glTexParameteri(GL_TEXTURE_2D,
. GL_TEXTURE_WRAP_S, GL_REPEAT);
call glTexParameteri(GL_TEXTURE_2D,
. GL_TEXTURE_WRAP_T, GL_REPEAT);
call glTexParameteri(GL_TEXTURE_2D,
. GL_TEXTURE_MAG_FILTER, GL_NEAREST);
call glTexParameteri(GL_TEXTURE_2D,
. GL_TEXTURE_MIN_FILTER, GL_NEAREST);
! glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight,
! 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);
call glTexImage2D(GL_TEXTURE_2D, 0, 4, 64,
. 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);
end
|
|
|
Back to top |
|
|
sefiroths
Joined: 17 Nov 2009 Posts: 10
|
Posted: Wed Nov 09, 2011 3:11 pm Post subject: |
|
|
Code: |
subroutine displayTexture
INTEGER*4 GL_QUADS
PARAMETER (GL_QUADS = z'0007')
INTEGER*4 GL_DECAL
PARAMETER (GL_DECAL = z'2101')
INTEGER*4 GL_TEXTURE_ENV_MODE
PARAMETER (GL_TEXTURE_ENV_MODE = z'2200')
INTEGER*4 GL_TEXTURE_ENV_COLOR
PARAMETER (GL_TEXTURE_ENV_COLOR = z'2201')
INTEGER*4 GL_TEXTURE_ENV
PARAMETER (GL_TEXTURE_ENV = z'2300')
INTEGER*4 GL_TEXTURE_2D
PARAMETER (GL_TEXTURE_2D = z'0DE1')
STDCALL GLTEXCOORD2F 'glTexCoord2f' (VAL,VAL)
STDCALL GLDISABLE 'glDisable' (VAL)
STDCALL GLENABLE 'glEnable' (VAL)
STDCALL GLTEXIMAGE2D
. 'glTexImage2D' (VAL,VAL,VAL,VAL,VAL,VAL,VAL,VAL,REF)
STDCALL GLPIXELSTOREI 'glPixelStorei' (VAL,VAL)
STDCALL GLGENTEXTURES 'glGenTextures' (VAL,REF)
STDCALL GLBINDTEXTURE 'glBindTexture' (VAL,VAL)
STDCALL GLCLEARCOLOR 'glClearColor' (VAL,VAL,VAL,VAL)
STDCALL GLSHADEMODEL 'glShadeModel' (VAL)
STDCALL GLVERTEX3F 'glVertex3f' (VAL,VAL,VAL)
STDCALL GLTEXENVF 'glTexEnvf' (VAL,VAL,VAL)
STDCALL GLBEGIN 'glBegin' (VAL)
! call glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
call glEnable(GL_TEXTURE_2D);
call glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
!#ifdef GL_VERSION_1_1
! glBindTexture(GL_TEXTURE_2D, texName);
!#endif
call glBegin(GL_QUADS);
call glTexCoord2f(0.0, 0.0);
call glVertex3f(-2.0, -1.0, -6.0);
call glTexCoord2f(0.0, 1.0);
call glVertex3f(-2.0, 1.0, -6.0);
call glTexCoord2f(1.0, 1.0);
call glVertex3f(0.0, 1.0, -6.0);
call glTexCoord2f(1.0, 0.0);
call glVertex3f(0.0, -1.0, -6.0);
call glTexCoord2f(0.0, 0.0);
call glVertex3f(1.0, -1.0, -6.0);
call glTexCoord2f(0.0, 1.0);
call glVertex3f(1.0, 1.0, -6.0);
call glTexCoord2f(1.0, 1.0);
call glVertex3f(2.41421, 1.0, -1.41);
call glTexCoord2f(1.0, 0.0);
call glVertex3f(2.41421, -1.0, -1.41);
call myglEnd();
!$$$$$$ call myglFlush();
call glDisable(GL_TEXTURE_2D);
end
|
but what is displayed is a black square
i'd like also to load an image from a file and display it.
do anyone have made it?
thanks |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2834 Location: South Pole, Antarctica
|
Posted: Mon Nov 21, 2011 7:24 pm Post subject: |
|
|
Have not done this but would be interested if you will go through the difficulties. Specifically i'm interesting in animated textures and guiding the objects in 3D with the mouse. But generally any new examples are welcome - it is a lot of fun if all goes through on OpenGL in this compiler but it's a hell if not. It needs more people using OpenGL with FTN95.
If anyone rewrite Ne-He tutorial made for many languages and dialects including Intel compilers for FTN95/OpenGL that would be great contribution.
http://nehe.gamedev.net/tutorial/flag_effect_waving_texture/16002/ |
|
Back to top |
|
|
sefiroths
Joined: 17 Nov 2009 Posts: 10
|
Posted: Wed Nov 23, 2011 9:32 am Post subject: |
|
|
i have made it working in many languages, but not in ftn95, so i'm wondering if i have make something wrong with fortran, or is a bug of the bindings
i hope some silverfrost stuff will answer |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2834 Location: South Pole, Antarctica
|
Posted: Tue Nov 29, 2011 7:25 am Post subject: |
|
|
Can you post the complete demo source code instead of some subs for us and developers to reproduce? |
|
Back to top |
|
|
acp693
Joined: 04 Sep 2006 Posts: 56
|
Posted: Tue Dec 06, 2011 4:40 pm Post subject: |
|
|
Hi have a look at this thread that I started a couple of years ago
http://forums.silverfrost.com/viewtopic.php?t=1344
I successfully created and used a 1d texture in opengl using silverfrost ( the code is in the thread)
Iit would only work with hardware acceleration switched off though. I think this has got something to do withthe silverfrost opengl implemantation as opengl programs using textures that I've written in other languages will run on the same computer with hardware acceleration on full.
Cheers
Albert |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2834 Location: South Pole, Antarctica
|
Posted: Fri Dec 09, 2011 7:48 am Post subject: |
|
|
Thanks for pointing at the post. Unfortunately compiled this code as-is does not produce anything besides white screen no matter what graphics settings are used (and in both XP and Win7). Can you confirm it still works, the post was 5 years ago. What kind of texture it creates, i do not see any texture graphics file in the code ? |
|
Back to top |
|
|
acp693
Joined: 04 Sep 2006 Posts: 56
|
Posted: Sat Dec 10, 2011 7:34 pm Post subject: |
|
|
Hi Dan,
I just copied and pasted the two files ( from the 3rd and 4th replies) into a new project ( in plato 4.3.0)
built it and it ran first time. it shows a triangle laid over with a 1 dimensional texture consisting of 4 colours, dark red, light red, light blue, dark blue. These colours are defined at the top of openglmod in array arrcol.
Please note there are two versions of the code in that thread, the one at the top of the thread doesn't work ( which is why i posted in the first place, it wouldn't work!) I worked further on the problem and found several mistakes which i explain lower down in the thread. The code that works is in the 3rd and 4th replies of that thread.
Please let me know ifyou get it to work. As I stated in the thread it would only work for me if I switched off hardware acceleration. This is one reason that I abandoned silverfrost and compiled all my math routines into a dll, and built a gui using other software.
best
Albert |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2834 Location: South Pole, Antarctica
|
Posted: Mon Dec 19, 2011 11:26 am Post subject: |
|
|
Thanks, Albert. Finally got it working in XP. Weird thing is that it now works at 0% and 20% hardware acceleration, further acceleration stops it. Fun is that in any acceleration be it 0% or 100% mode my other OpenGL stuff works similarly fast. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2834 Location: South Pole, Antarctica
|
Posted: Wed Dec 28, 2011 8:12 pm Post subject: |
|
|
-Do you have by chance FTN95 example with bitmap textures?
-Or moving textures (the waving flag is a typical example in OpenGL examples written for other languages)?
-And also an example with specular reflection (couldn't make it working). Like those on the surfaces or reflective solids, water etc |
|
Back to top |
|
|
|
|
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 You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|